Hi,
I noticed the following code fails to keep radiobutton grouping
information, due to my constructing the UI in several passes with a few
get_widget->pack_end(get_widget) calls...
The result is confusing, with all radiobuttons selected instead of one
per group!
The thing is, if I manually create an XML vbox and add() it to my frame,
it works fine, but makes my code even more of a mess.
Could anybody enlighten me ?
Thanks
David
=====================
# Here's the (pseudo-)code
Gtk::GladeXML->new('test_window.glade','window_main' );
my $i = 1;
my $pos = tell DATA;
foreach my $source (@sources) {
seek DATA, $pos, 0;
my $xml_widget;
$xml_widget = join('', (<DATA>))
$xml_widget =~ s/##text##/$source/;
$xml_widget =~ s/##num##/$i/;
$xml_widget = Gtk::GladeXML->new_from_memory($xml_widget);
$xml_widget->get_widget(
"radiobutton_disk_restore_$i")->signal_connect(
"clicked", sub { $restoration->source($source); });
$window->get_widget('vbox_restore_disk_source')->pack_end_defaults(
$xml_widget->get_widget("radiobutton_disk_restore_$i"));
$i++;
}
__DATA__
<GTK-Interface>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton_disk_restore_##num##</name>
<can_focus>True</can_focus>
<label>##text##</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>disk_restore_source</group>
</widget>
</GTK-Interface>
--
+-----------------------------------+
| David Morel <dmorel intradot com> |
| http://www.intradot.com |
+-----------------------------------+
| Intradot Labs |
| 2, rue Cuzin |
| F-69120 Vaulx-en-Velin |
| tel: +33 478 80 87 90 |
+-----------------------------------+
Attachment:
signature.asc
Description: OpenPGP digital signature