Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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" ()
	initializer
	    winMain#add butNew; (* This would seem the obvious thing to
do but it doesn't work *)
	    winMain#connect#destroy ~callback:Main.quit;
	    winMain#show ()
    end

	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
-- 

   Andrew Lawson
andrew@absentis.com
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