[gtk2-perl-xs] GtkRadioButton RFC
- From: Ross McFarland <rwmcfa1 neces com>
- To: gtk-perl-list gnome org
- Subject: [gtk2-perl-xs] GtkRadioButton RFC
- Date: 21 Apr 2003 21:02:17 -0400
earlier today i commited an attempt at getting Gtk2::RadioButton fully
supported in gtk2-perl-xs.
it is implemented quite differently from gtk2-perl (and gtk-perl for
that matter.)
for those of you so inclined, beat and bang it in an effort to break it.
for examples of how it's used see Gtk2/t/9.GtkRadioButton.t. also
general comments on the arch are desired.
the gist of it is that when creating a new Gtk2::RadioButton with any of
the new functions you can either supply a widget that is a member of a
group you would like this new one to be a member of (1) or you can
supply a reference to an array of radiobuttons (2) like you'd will get
from $rdobtn->get_group (3, which is the other main difference/change)
1)
$rdobtn = Gtk2::RadioButton->new(undef, 'this is a label');
this creates a new radio button that is part of a new group. so now
doing the following will create another member of this group.
$rdobtn = Gtk2::RadioButton->new($rdobtn, 'this is another label');
2)
or for a more complex, not really recomended b/c of the overhead, method
you can do the following.
$rdobtn = Gtk2::RadioButton->new( $rdobtn->get_group, 'this is another
label');
this method is there so that things will behave much like their c
counterpart. also so that you can do things like this
for( $i = 0; $i < 10; $i++ )
{
$rdobtns[$i] = Gtk2::RadioButton->new(\ rdobtns, $i);
}
3)
the other advantage of this method is that you can iterate through the
array reference returned by $rdobtn->get_group in perl i.e.
foreach (@{$rdobtn->get_group})
{
$_->do_something_on_them;
}
you can perform operations on the group returned, but you can not modify
the group by adding/removing buttons in the perl array reference. this
should be done as is from c with the $rdobtn->set_group(xxx) function
which now takes a things in the manner of (1), (2).
in all likelihood there exist some bugs in the code (if not even core
dumps) i've tried it a bunch of ways, with the test script, and it
works. i would like for others to do the same with their own code.
i'll workup Gtk2::RadioMenuItem to do much the same very soon provided
that the consensus is that this is good. suggestions/comments/problems
welcome...
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]