Date: Mon, 12 Sep 2005 09:43:25 +0900 (JST) Message-Id: <20050912.094325.56814922.garrigue at math.nagoya-u.ac.jp> To: romildo at uber.com.br Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: Implementing gtk_plot_canvas_plot_new(GtkPlot * plot) From: Jacques Garrigue In-Reply-To: <20050910224625.GA27168 at malaquias> References: <20050910200253.GA26631 at malaquias> <20050910224625.GA27168@malaquias> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: romildo at uber.com.br > I think I have found a solution. It is anoted below. > > (* converstion method, to extract the object from the class *) > method as_plot : GtkExtra.plot Gtk.obj = obj > > > end > > > let plot_canvas_plot plot ?packing ?show () : plot_canvas_plot = > > let w = PlotCanvasPlot.create plot in > ^^^^ > (plot#as_plot) > > > GObj.pack_return (new plot_canvas_plot w) ~packing ~show > > Is that the right way to do it? Indeed. One frequently needs a way to extract the Gtk object from its wrapper, and it is the only statically safe way to do this. Jacques