Re: GnomeCanvas Enumerate Items

Gregory Malecha <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Thanks for the help.

Now I've come upon another problem. I'm failing to see how I'm suppose 
to get the properties of something like this. For example, I have a 
polygon and I want to iterate through the points or get the background 
color.

Thanks.

Jacques Garrigue wrote:
> 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>
>
>   

-- 
gregory malecha
wiess college
computer science
219.510.3400
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.