Re: "changed" signal
- From: muppet <scott asofyet org>
- To: Ari Jolma <ari jolma tkk fi>
- Cc: gtk-perl-list gnome org
- Subject: Re: "changed" signal
- Date: Sat, 5 Mar 2005 11:12:01 -0500
On Mar 5, 2005, at 9:22 AM, Ari Jolma wrote:
my $h = new_with_range Gtk2::HScale (0,10,1);
$h->signal_connect("changed" => sub {print "changed\n" });
$h->signal_connect("value-changed" => sub {print"value changed\n"} );
this gives a warning: signal "changed" is invalid
Indeed, because "changed" is one of Gtk2::Adjustment's signals, not a
Gtk2::Scale's.
Also, the "changed" signal means that the properties of the adjustment
have changed -- e.g. the max value, the min value, the step increment.
The *value-changed* signal of Gtk2::Adjustment is what gets fired with
the actual current value changes.
http://developer.gnome.org/doc/API/2.0/gtk/
GtkAdjustment.html#GtkAdjustment-changed
my $h = new_with_range Gtk2::HScale (0,10,1);
$h->get_adjustment->signal_connect("changed" => sub {print "changed\n"
});
$h->signal_connect("value-changed" => sub {print"value changed\n"} );
this does not give a warning but the subroutine is never called, even
though I resize the scale (it is in a window)
I get "value-changed" called on every move of the slider.
#!/usr/bin/perl -w
use strict;
use Glib ':constants';
use Gtk2 -init;
my $window = Gtk2::Window->new;
$window->signal_connect (destroy => sub {Gtk2->main_quit});
my $h = new_with_range Gtk2::HScale (0, 10, 1);
$h->signal_connect (value_changed => sub {
print "value-changed : now ".$h->get_value."\n"
});
$window->add ($h);
$window->show_all;
Gtk2->main;
--
I bring the rock, and provided it is fiscally responsible, I will bring
the funk as well. And that's fo-shizzle.
-- Saturday Night Live
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]