Re: [gtk-list] (Tricky?) questions about GTK widget hierarchy andGNOME canvas




> Can I pack this Box into different pages
> on my notebook (providing the same pointer all the time) or do I have
> to create a new one for each page?  It seems that GTK API allows that,
> but will the widget behave as expected (e.g., can I have two "views"
> of that widget on the screen simultaneously).
>

Nope, you can't have two views; you have to make two widgets. My
suggestion is to have some kind of data structure that both widgets
represent. You might for example store your displayed information and a
list of widgets; and whenever you update the info automatically update all
the widgets.
 
> BUT: Can we have several identical adders on one canvas? 

Yes, but again they can't be the same GnomeCanvasItem; you need to create
multiple items, then keep them in sync.

>      Can we have several identical adders on several canvases?

Items are irrevocably bound to the canvas they were created on,
unfortunately.

> I do not expect that this will work (from the same header file: "The
> only information a GnomeCanvasItem contains is its parent canvas,
> etc."), but then how it was intended to implement that "schematic
> display"? ;-)
>

You need to keep your own data structure, rather than bundling the
structure of your application up with the GUI. Then keep pointers to the
associated canvas items and update them when your data structure changes.
 
> And, finally the last easy one: How to I walk through all objects
> attached to a Canvas?
> 

You can start with the root group and traverse group->item_list for each
group; I don't know if this is officially "allowed" but it should work (as
long as you don't try to add or remove items while you're walking the
list).

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]