Re: Gtk2::Entry and signals
- From: "Ross McFarland" <rwmcfa1 neces com>
- To: "Cornel Ghiban" <green neomedia ro>
- Cc: gtk-perl-list gnome org
- Subject: Re: Gtk2::Entry and signals
- Date: Wed, 28 Jan 2004 09:07:15 -0500 (EST)
Cornel Ghiban said:
# $e->signal_handlers_block($e->{handle_id});
# $e->signal_handlers_unblock($e->{handle_id});
I found an example in C API of GtkEditable on how to force an entry to
uppercase. It didn't work as expected () and than I tried to use the method
signal_handlers_block() but this one failed.
it's singular, not plural, when you're blocking with an id. in this case this
is the route you should go.
as far as the upper case thing goes just use the perl uc function on the text
you pass to set_text and it should work.
the following code works as expected for me.
-rm
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 '-init';
my $win = Gtk2::Window->new;
$win->set_border_width (6);
$win->signal_connect (destroy => sub { Gtk2->main_quit });
my $entry = Gtk2::Entry->new;
$win->add ($entry);
$entry->{ch} = $entry->signal_connect (changed => sub {
print STDERR "changed\n";
my $self = shift;
$self->signal_handler_block ($self->{ch});
$self->set_text (42);
$self->signal_handler_unblock ($self->{ch});
});
$win->show_all;
Gtk2->main;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]