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



Olivier Guilyardi wrote:
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,

This is exactly the way I expected it to work, and it does. Thanks for the confirmation on the functionality. It help me find the real problem that was somewhere else. At least now I know for sure that this procedure is acceptable.

Thanks,
dave



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