Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] Ocaml + GUI + Mac + Mono?

Expand Messages
  • Savanni D'Gerinel
    Okay, no mono. Thank you. That saves me from a very great many hours of potentially frustrating research and software installation. On the other hand, I can
    Message 1 of 9 , Oct 3, 2008
    • 0 Attachment
      Okay, no mono. Thank you. That saves me from a very great many
      hours of potentially frustrating research and software installation.

      On the other hand, I can see Mono + F# being useful to me to solve
      other problems, but those are not important now.

      From the rest of what you and Richard Jones say, I think my plan of
      action is this...

      * Use labltk or lablgtk to build software on Aqua, unless I find a
      solid Cocoa binding. Technically, there is Cocoa#, but I will look
      into that when I look into mono. Either way, separate presentation
      from logic as much as I absolutely possibly can.
      * Port the presentation layer to other platforms when I decide that I
      want to use the other platforms.

      --
      Savanni

      On Oct 2, 2008, at 1:15 PM, Jon Harrop wrote:

      > On Thursday 02 October 2008 17:47:14 Savanni D'Gerinel wrote:
      > > Bringing my question here.
      > >
      > > I am about to start development on a gui application in Ocaml. It
      > > will not be big, just a couple of toy applications, one being a fuel
      > > efficiency tracker, another being a character sheet application
      > > dynamically tracking all bonuses and target numbers for AD&D 3.5.
      > > Maybe even something to help me keep track of my workouts. Nothing
      > > serious. They are just practice applications to get me to finally
      > > learn GUI programming, and to prepare for something much, much
      > bigger
      > > in the future. I have a couple of unshakable criteria, those
      > being...
      > >
      > > * Write in Ocaml (because it Rocks)
      >
      > Amen.
      >
      > > * Make it a Native-Mac GUI on my Mac (because I am tired of XDarwin)
      >
      > The last time I looked, the native-Mac-GUI-in-OCaml problem had not
      > been
      > solved but several people were trying to solve it.
      >
      > > * Make it portable to both Windows and Linux (with a recompile)
      >
      > Does that not conflict with "native-Mac GUI"?
      >
      > > So far, the only option that looks obviously ready and complete is
      > > using labltk.
      >
      > I believe LablGTK is a definite possibility. It works very well
      > under Linux
      > but I have not tried porting the software (I gave up on my Mac).
      >
      > > I do not mind this idea at all and am totally willing
      > > to go with it, and I have some overall documentation on how to
      > use it
      > > at http://www.cocan.org/getting_started_with_ocaml_on_mac_os_x .
      > >
      > > I would prefer to use QT, but I can find no Ocaml bindings, and
      > > writing such a binding is certainly beyond my skill and interest at
      > > this time.
      >
      > You might try going via another language with more mature Qt
      > bindings, e.g.
      > using PyQt, but I do not know of any tutorials covering this.
      >
      > > On the other hand, I hear that there is a standard gui in Mono
      > called
      > > Windows Forms, though there is a Windows Presentation Layer that my
      > > source is not certain has been ported to Mono yet. So, I really have
      > > several questions here:
      > >
      > > 1. Does this Windows Forms gui bind directly to Aqua so that I
      > have a
      > > Mac-looking application without running Darwin?
      >
      > No:
      >
      > "Looks alien on non-Windows platforms." -
      > http://www.mono-project.com/Gui_Toolkits
      >
      > > 2. What advantage is there to me writing my app in F# with Mono
      > on my
      > > Mac?
      >
      > None. Only on Windows, F# makes GUI programming vastly easier than
      > anything
      > OCaml has to offer. So it may be worth considering OCaml/F# cross
      > compilation
      > of the core.
      >
      > > 3. What way do you all most often use to write cross-platform GUI
      > > apps that actually look like the underlying platform?
      >
      > I am not aware of anyone ever having succeeded in doing that. The
      > nearest I
      > can think of is Gtk apps but they have anomalous behaviour under
      > Mac OS X.
      > MLDonkey contains 20kLOC of cross platform GUI code using GTK2, for
      > example.
      >
      > --
      > Dr Jon Harrop, Flying Frog Consultancy Ltd.
      > http://www.ffconsultancy.com/?e
      >
      >



      [Non-text portions of this message have been removed]
    • Philippe Strauss
      ... unfortunately not, at least not when requiring lablgtkgl. If you can do without GL embedding in gtk, it will probably build fine, with just a tiny patch
      Message 2 of 9 , Oct 4, 2008
      • 0 Attachment
        On Fri, Oct 03, 2008 at 09:02:58AM +0200, Adrien wrote:
        > 2008/10/2, Savanni D'Gerinel <savanni@...>:
        > > Bringing my question here.
        > >
        > > I am about to start development on a gui application in Ocaml. It
        > > will not be big, just a couple of toy applications, one being a fuel
        > > efficiency tracker, another being a character sheet application
        > > dynamically tracking all bonuses and target numbers for AD&D 3.5.
        > > Maybe even something to help me keep track of my workouts. Nothing
        > > serious. They are just practice applications to get me to finally
        > > learn GUI programming, and to prepare for something much, much bigger
        > > in the future. I have a couple of unshakable criteria, those being...
        > >
        > > * Write in Ocaml (because it Rocks)
        > > * Make it a Native-Mac GUI on my Mac (because I am tired of XDarwin)
        >
        > Have you tried the native mac port of gtk ?
        > You have two (more ?) available : one for gtk-1.2[1] and one for
        > gtk-2[2]. I've never tried them as I don't use macs but I think gimp
        > has been made to use the first one and I trust imendio, the company
        > doing the second one, for releasing good code (partly because I know
        > some of the devs and partly because the *definitely* want native gtk
        > on the mac ; they're doing gtk development).
        >
        > Philippe Strauss has recently tried imendio's gtk with lablgtk but had
        > troubles building it, unfortunately I don't know if his problem has
        > been solved or not. [3]

        unfortunately not, at least not when requiring lablgtkgl. If you can
        do without GL embedding in gtk, it will probably build fine, with
        just a tiny patch that Pascal Cuoq provided.

        if you need lablgtkgl, you'll most probably chokes on a missing
        symbol _GDK_DISPLAY (maybe related to X11, or double underscored somewhere,
        i have to dig in further). (most probably gtkgl need a little bit of
        patchwork for native gtk osx support).

        regards.

        ---8<---
        diff -ru lablgtk-2.10.1/src/ml_gdk.c lablgtk-2.10.1-nativegtk/src/ml_gdk.c
        --- lablgtk-2.10.1/src/ml_gdk.c 2007-09-25 04:56:09.000000000 +0200
        +++ lablgtk-2.10.1-nativegtk/src/ml_gdk.c 2008-02-26 11:10:30.000000000 +0100
        @@ -22,13 +22,18 @@

        /* $Id: ml_gdk.c 1369 2007-09-25 02:56:09Z garrigue $ */

        +#define __QUARTZ__
        +
        #include <string.h>
        #include <gdk/gdk.h>
        +#if defined(__QUARTZ__)
        +#else
        #if defined(_WIN32) || defined(__MINGW32__)
        #include <gdk/gdkwin32.h>
        #else
        #include <gdk/gdkx.h>
        #endif
        +#endif
        #include <caml/mlvalues.h>
        #include <caml/alloc.h>
        #include <caml/memory.h>
        @@ -253,7 +258,7 @@
        ML_0 (GDK_ROOT_PARENT, Val_GdkWindow)
        ML_1 (gdk_window_get_parent, GdkWindow_val, Val_GdkWindow)

        -#if defined(_WIN32) || defined(__CYGWIN__)
        +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__QUARTZ__)
        CAMLprim value ml_GDK_WINDOW_XWINDOW(value v)
        {
        ml_raise_gdk ("Not available for Win32");
        @@ -488,7 +493,7 @@
        CAMLprim value ml_gdk_property_get (value window, value property,
        value length, value pdelete)
        {
        -#if defined(_WIN32) || defined(__CYGWIN__)
        +#if defined(_WIN32) || defined(__CYGWIN__)|| defined(__QUARTZ__)
        return Val_unit; /* not supported */
        #else
        GdkAtom atype;
        ---8<---

        ...
        > [1] http://gtk-cocoa.sourceforge.net/Gtk+-Cocoa.jpg
        > [2] http://developer.imendio.com/projects/gtk-macosx
        > [3] http://yquem.inria.fr/pipermail/lablgtk/2008-August/000203.html
        > [4] http://ocaml.janestcapital.com/?q=node/38

        --
        Philippe Strauss
        http://philou.ch
      Your message has been successfully submitted and would be delivered to recipients shortly.