Re: Locating child-widgets (by name) without Glade-code



On Tue, 2003-08-19 at 04:08, Michal Tomcanyi wrote:
Hello,

 I don't know for what reason do you want to locate your widgets, but in my
 case I used gtk_container_get_focus_chain() and 
 gtk_container_set_focus_chain().
 You can pre-define order of your widgets and "save" the order to the
 container using set() function. When needed, the list can be obtained by
 get() function. As you have pre-defined the order, you can be sure about
 it and search it safely... (I am not sure how it works with
 gtk_container_get_children())

 It is neither fast nor clean, but it can help if you don't want to use a
 lot of global variables.

Please don't do this! :-)  

If you feel a need to use gtk_widget_get_name() to locate widgets, just
recursively hunt using gtk_container_foreach(). Or use a hash table.

Using the focus chain for this is not a sensible thing. The focus chain
is for setting the order in which widgets are focused.

Regards,
                                                Owen





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