Re: Bug in Gtk2::ToggleButton->new_from_stock()
- From: muppet <scott asofyet org>
- To: Jörn Reder <joern zyn de>
- Cc: gtk-perl-list gnome org
- Subject: Re: Bug in Gtk2::ToggleButton->new_from_stock()
- Date: Sat, 27 May 2006 14:26:44 -0400
On May 27, 2006, at 3:32 AM, Jörn Reder wrote:
I think I found a bug in Gtk2::ToggleButton. When using
new_from_stock()
a Gtk2::Button is returned.
Your call to Gtk2::ToggleButton->new_from_stock() is resolving to
Gtk2::Button::new_from_stock(), because ToggleButton isa Button, and
there is no gtk_toggle_button_new_from_stock().
http://developer.gnome.org/doc/API/2.0/gtk/GtkToggleButton.html lists
gtk_toggle_button_new()
gtk_toggle_button_new_with_label()
gtk_toggle_button_new_with_mnemonic()
Gtk2::ToggleButton::new() is calls gtk_toggle_button_new_with_mnemonic
() if it gets an argument, otherwise gtk_toggle_button_new().
So, the solution is to take advantage of Gtk2::Button::set_use_stock
(), like this:
#!/usr/bin/perl -w
use strict;
use Glib 'TRUE';
use Gtk2 -init;
my $window = Gtk2::Window->new;
$window->signal_connect (destroy => sub { Gtk2->main_quit });
my $toggle = Gtk2::ToggleButton->new ('gtk-ok');
$toggle->set_use_stock (TRUE);
$window->add ($toggle);
$window->show_all;
Gtk2->main;
--
And then mama would throw the live crawdads in the boilin' water.
And one day I decided I'd make my own crawdads. So I threw the
crawdads in the pot, but without any water. It was just like makin'
popcorn.
-- Ear-bending cellmate, "Raising Arizona"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]