Re: radioitem



muppet wrote:
probably belongs in the FAQ:

http://mail.gnome.org/archives/gtk-perl-list/2003-September/msg00081.html
http://mail.gnome.org/archives/gtk-perl-list/2004-April/msg00115.html
http://mail.gnome.org/archives/gtk-perl-list/2005-March/msg00039.html

Thanks, but I still have a problem. It trigger action twice on every event, what could be the reason?

use Gtk2::SimpleMenu;

...
    children   => [
        'Radio One' => {
           callback  => sub { $self->radio_callback},
           item_type => '<RadioItem>',
           groupid   => 1
         },
        'Radio Two'  => {
           callback  => sub { $self->radio_callback},,
           item_type => '<RadioItem>',
           groupid   => 1
        },
...

sub radio_callback {
  my $self = shift;
  if ($self->{menu}->get_widget('/Radio/Radio One')->get_active) {
      print "Radio One active\n";
   }
}

When I select Radio One, it prints:

Radio One active
Radio One active



--

--beast




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