Names in Glade XML files must be unique?



Hi all.

I've just experienced some pretty weird behaviour when using Glade XML files. It seems that Gtk2::GladeXML's get_widget() will get hold of the *first* object if finds with the given name ( outside of it's "scope" ) instead of selecting the right one.

For example, I have 2 windows. In Glade, they're called "MainMenu" and "Batches".
In Perl, I create them:

$mainmenu = Gtk2::GladeXML->new($gladefile, "MainMenu");
$mainmenu->signal_autoconnect_from_package;

$batches = Gtk2::GladeXML->new($gladefile, "Batches");
$batches->signal_autoconnect_from_package;

Now, my MainMenu form has a *button* on it, called "Batches" ... because it's the batches button, which opens the batches form.

If I try to get hold of the "Batches" window, via:

$batches->get_widget("Batches")

I instead get the Batches *button*, on the MainMenu form.

I realise I can get around this by using unique names ( eg calling the button btnBatches or something ), but still ... shouldn't the work? How is the $batches object getting hold of something on the $mainmenu object?

Any plans to fix this behaviour?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 114434

The following links have been inserted by the NUS Consulting internal spam filter and are for NUS Consulting staff only
Spam
Not spam
Forget previous vote


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