From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA10950 for caml-red; Sat, 10 Feb 2001 22:19:16 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA22665 for ; Fri, 9 Feb 2001 20:58:11 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f19Jw4P21292; Fri, 9 Feb 2001 20:58:04 +0100 (MET) Received: (from vouillon@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA12801; Fri, 9 Feb 2001 20:58:03 +0100 (MET) Date: Fri, 9 Feb 2001 20:58:03 +0100 From: Jerome Vouillon To: Jacques Garrigue Cc: frouaix@liquidmarket.com, caml-list@inria.fr Subject: Re: OCaml's long range graphical direction? Message-ID: <20010209205803.A7869@pauillac.inria.fr> References: <20010206102842.A27059@pauillac.inria.fr> <200102082001.f18K1VH08374@nez-perce.inria.fr> <20010209184901V.garrigue@kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20010209184901V.garrigue@kurims.kyoto-u.ac.jp>; from garrigue@kurims.kyoto-u.ac.jp on Fri, Feb 09, 2001 at 06:49:01PM +0900 Sender: weis@pauillac.inria.fr On Fri, Feb 09, 2001 at 06:49:01PM +0900, Jacques Garrigue wrote: > In fact, the gnome project has a GUI builder called glade, which > allows one to produce either C code or an XML representation of the > interface. There is even a library libglade which allows one to > dynamically load such an XML representation and use it in a program. > > It would be pretty easy to either interface to this library, I don't think it would be a good idea to interface to this library, as it is designed for C, which does not have higher-order function (so, the library assumes that there is one function by call-back). > or, more > interestingly, build a parser and interpreter for it, so as to be able > to use glade's output in lablgtk or mlgtk programs. For the parser, one can just use PXP. The interpreter is a lot of work though... Some time ago, I started to write one, but it only supports a few widgets yet. > Still, I'm not sure I would use it personally. Basically, when I write > a lablgtk application, the code is not in the GUI layout: this is just > one line per widget. It is in all the callbacks and dynamic > processing. I'm not so sure a GUI builder will help you a lot with > that, because it can also get in your way. I disagree. When designing an interface, there are a lot of tweakings (frame widths, alignements, ...) which are easily done using an interface builder but much more tedious to program (and you often need to recompile a lot of time to get them right). > The last problem is how to stay type safe when you load a text file. > Basically this means that you will be more verbose, and that will > compare badly with guile-gtk or python-gtk based applications. I get some code that look like this. This does not look that verbose to me. let select_date w0 date cont = let gl = interface () in let (w, ctx) = create_dialog gl "choix de la date" ["valider", any (fun ctx _ _ -> (toplevel ctx)#destroy (); w0#misc#set_sensitive true; let (year, month, day) = (calendar ctx "calendrier")#date in cont {day = day; month = month + 1; year = year}); "annuler", any (fun ctx _ _ -> (toplevel ctx)#destroy (); w0#misc#set_sensitive true)] in w0#misc#set_sensitive false; w#set_transient_for w0; begin match date with None -> () | Some d -> let c = calendar ctx "calendrier" in c#select_month (d.month - 1) d.year; c#select_day d.day end; w#show () -- Jerome