English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] lablGtk - newbie question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-06 (14:36)
From: Andrew Lawson <andrew@a...>
Subject: [Caml-list] lablGtk - newbie question
Hi all
	I've just started learning ocaml and lablGtk. I'm writing a
small utility and I'm trying to encapsulate the gui in a class, a
simplified example is below;

class mainWindow () =
    object (self)
	val winMain = GWindow.window ~title:"Cadb" ~border_width:10
i					~width:400 ~height:400 ()
	val butNew = GButton.button ~label:"New" ()
	    winMain#add butNew; (* This would seem the obvious thing to
do but it doesn't work *)
	    winMain#connect#destroy ~callback:Main.quit;
	    winMain#show ()

	Now I have to pack the button into the window, obviously I can't
do it in the val expression but I can't work out how to do it in the
initializer. Can someone help?


   Andrew Lawson
Swindon, Wilts, Uk
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr