ToggleButton Change Icon
- From: "William B Carlson" <carls107 msu edu>
 
- To: gtk-perl-list gnome org
 
- Subject: ToggleButton Change Icon
 
- Date: Tue, 24 Aug 2004 09:11:27 -0400
 
I have ToggleButton, which is used to start and stop a process.  I was 
wondering if there was a way to use the stock icons (gtk-start, gtk-stop) in 
place of the Start and Stop text. 
Basically the toggle button would start out with the gtk-start icon and when 
pressed it would switch to the gtk-stop icon.  This is so I would only have 
to use one icon in the toolbar. 
my $button_start = Gtk2::ToggleButton->new('Start');
$button_start->signal_connect (toggled => sub {
              if ($_[0]->get_active) {
                 $_[0]->child->set_text ('Stop');
                 Glib::Timeout->add(2000, \&start_cb );
              } else {
                 $_[0]->child->set_text ('Start');
                }
              }); 
Thanks for your time, 
Ben 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]