Delivered-To: lablgtk at yquem.inria.fr Date: Wed, 30 Jan 2008 16:11:11 +0900 (JST) Message-Id: <20080130.161111.48533977.garrigue at math.nagoya-u.ac.jp> To: gmalecha at rice.edu Subject: Re: [Lablgtk] GnomeCanvas Enumerate Items From: Jacques Garrigue In-Reply-To: <47A01A5D.8030706 at rice.edu> References: <20080105.170933.98869039.garrigue at math.nagoya-u.ac.jp> <47A01A5D.8030706@rice.edu> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: lablgtk at yquem.inria.fr Content-Type: Text/Plain; charset=us-ascii Content-Length: 1234 From: Gregory Malecha > I was able to get most of this working using wrap_item. There are a few > cases that it apparently doesn't handle though. Mainly group, text, > rich_text, etc, the ones that aren't GnoCanvas.items. Here's the code > that I have: > > type annotated_item = > Group of GnomeCanvas.group_p GnoCanvas.item (* I'd like this to be > GnoCanvas.group *) [...] > else if GnomeCanvas.Types.is_a item GnomeCanvas.Types.group then > let gp = GnoCanvas.wrap_item item GnomeCanvas.Types.group in > Group gp [..] > Does anyone know of a way to get a GnoCanvas.group rather than a > GnomeCanvas.group_p GnoCanvas.item when performing the cast? Since you have already checked that it has the right type, you can use Gobject.unsafe_cast. new GnomeCanvas.group (Gobject.unsafe_cast item) Looks safe enough to me. Jacques --------------------------------------------------------------------------- Jacques Garrigue Nagoya University garrigue at math.nagoya-u.ac.jp JG _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk