Re: How to create unique widget when reusing widget id's from a GladeXML object.



Hi,

dhk wrote:
How can a unique widget be created by using the same widget from a GladeXML object multiple times?

You can use different GladeXML objects, constructed out of the same glade file. Example:

GladeXML *xml = glade_xml_new("test.glade", NULL, NULL);
GtkWidget *widget1 = glade_xml_get_widget(xml, "mywidget");

GladeXML *xml2 = glade_xml_new("test.glade", NULL, NULL);
GtkWidget *widget2 = glade_xml_get_widget(xml2, "mywidget");

Here widget1 and widget2 (and their children) are different "instances" of mywidget.

About performance, from the liblglade manual : "the XML parse tree is cached to speed up creating another GladeXML object for the same file".

Regards,

--
  Olivier Guilyardi / Samalyse



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