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



Gus Koppel wrote:

And if there isn't a similar GTK+-function (as I suppose), is using
gtk_container_get_children () and recursively comparing the names of the
children against the searched one the correct + most efficient way?

I dunno if there is a correct way to do this, but I need code that would look them up so I just looped thought the children using gtk_container_get_children() like you're describing. Perhaps there is a better way, and if so I'd love to here it, but this method does work none the less and it works pretty well. I'm a realitivly new C coder as well so my code may be some what bad. If you'd like to see it though you can check it out here:

http://cvs.kicken.mine.nu:8008/cvsweb.cgi/LNote/common.c?rev=1.4&content-type=text/x-cvsweb-markup

Specifically it's the get_widget_with_name() and find_child_widget_with_name() functions that you'd need from my code. To use them I do this:

GtkWidget *textarea=get_widget_with_name(w, "EditorTextarea");

Where w is some widget and "EditorTextarea" is the name, in this example the name of a GtkTextView.

Hope that helps some.

--
http://kicken.mine.nu:8008/  - Personal Site
http://wiser.kicks-ass.org:8008/  - Long-term Project
Keith Maika




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