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



Keith Maika wrote:

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

Your code appears to leak memory since you don't free the GLists you
obtain from gtk_container_get_children ()!

My one-function solution to find a widget by name can currently be found
at http://www.spamkiller.bytechase.cx/democode/widget_find_by_name.c

A third parameter is supplied for some search optimization. It allows
you to limit the search to a number of levels of children if you believe
the searched widget isn't nested deeper than a given level. 0 = (almost)
unlimited search.}



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