Re: GnomeCanvas Enumerate Items
Jacques Garrigue <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
From: Gregory Malecha <[email protected]> > 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 <A HREF=http://www.math.nagoya-u.ac.jp/~garrigue/>JG</A>