Date: Fri, 4 Jul 2003 16:53:28 +0100 To: lablgtk at kaba.or.jp Subject: Inherit my own widget from another Message-ID: <20030704155328.GB28782 at redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline From: Richard Jones I'm getting a bit lost trying to create my own widget. The widget I want to create will have a drawing area & a scrollbar, contained inside a vbox. It seemed a good idea, therefore, to inherit from the box class. This is as far as I've got: open GObj open GContainer open GPack class graph obj = object (self) inherit box obj val da = GMisc.drawing_area ~packing:self#add () val drawable = da#misc#realize (); new GDraw.drawable da#misc#window method test = "test" end let graph ?homogeneous ?spacing ?border_width ?width ?height ?packing ?show () = let w = Box.create dir ?homogeneous ?spacing () in Container.set w ?border_width ?width ?height; pack_return (new graph w) ~packing ~show There's a couple of problems here, not least the fact that it doesn't compile (because the initialization of 'da' can't refer to 'self', although it needs to). Also I'm having to copy in lines of code directly from gPack.ml, which doesn't help with maintainability. Is there some obvious thing I'm missing here? Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you. MONOLITH is an advanced framework for writing web applications in C, easier than using Perl & Java, much faster and smaller, reusable widget-based arch, database-backed, discussion, chat, calendaring: http://www.annexia.org/freeware/monolith/