GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu May 23, 2013 8:51 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Obtaining Widget Tree for Toplevel Window
PostPosted: Sun Nov 22, 2009 10:51 pm 
This weekend's project has been to work on Gnocl's binding to the LibGlade libraries. So far, so good. For those interested, here's the tcl test script.

[code=]#---------------
# gladeXMLTest.tcl
#---------------
# William J Giddings
# 21-Nov-2009
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl
package require GnoclGladeXML

gnocl::gladeXML glade calculator.glade

gnocl::mainLoop[/code]

And here's a screenshot:

Image

Now, the next step is responding to events. By far the simplest and quickest way to do this is to provide script the access to the widgets constructed in the glade file.

Anyone got any suggestions on how to 'step' through the widget tree? Is there an arcane Gtk+ call that will 'reveal all'?

I need to supply widget pointers in order to register them with the Tcl Interpreter.

Thanks.

Will


Top
  
 
 Post subject: Problem solved, I've got the tree heirarchy!
PostPosted: Mon Nov 23, 2009 12:41 am 
Wow! This was easier than I thought!!!
The glade file provides names for the widget, much better than I'd hoped for. This means that I can assign script variables as names for these objects using the info contained in the glade file. Here's the snippet that lists the widget tree....

[code=] GList *widgetList, *p;
widgetList =glade_xml_get_widget_prefix (xml, "");
/* build up a list of names */
for ( p = widgetList; p != NULL; p = p->next )
{
const gchar *name = gtk_widget_get_name(GTK_WIDGET ( p->data ));
g_print("%s\n",name);
}[/code]

Hope to get this one sorted soon....

Will


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group