Re: Signals



ADIS - C.P.D. said:
use Gtk2 '-init';
use Glib qw/TRUE FALSE/;

$window = Gtk2::Window->new('toplevel');
$button = Gtk2::Button->new('MyButton');
$button->signal_connect('clicked' => \&handle);

sub handle {
    my $button = shift;
    $button->set_sensitive(FALSE);
    sleep 3;
}

How can I do set_sensitive make change in button before handle ends?

the following will process events until there are none pending.
   Gtk2->main_iteration while (Gtk2->events_pending);

if you were to put that before the sleep call the sensitive change should take
effect first. not sure why you'd be sleeping in a gui app (thus making the ui
unresponsive.) if you're wanting something to happen at a later time take a
look at Glib::Timeout->add (g_timeout_add.) as it may be a better option.

-rm



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