Re: Can't find signals for...


Martynas Jocius wrote:

Hello again.

I have two questions about signals.

1. I have a Gtk::Combo object. For example:
$combo = new Gtk::Combo;

I set items (with set_popdown_strings) and I want to know when one of 
these items has been selected. O try to connect with
"selection_request_event" and other all with "select" in their names. 
F.e.: $combo->entry->signal_connect(
         "selection_request_event", sub { print "sel "; });
But I can't find signal to catche this action (never prints "sel"). Signal
"activate" doesn't work too. What should I do?
I often use the 'changed' signal of the entry but then you will get many
signals if you type into the entry.
2. I have to catch a "key_press_event" (or another one who does that): 
I have a Gtk::Editable object and I want to check for the text in it 
after any character was typed. I do:
$text->signal("key_press_event", sub { &foo(); });
It works, but not as I want to. It checks for a text without typed 
character, it means before the character is added to the buffer. 
So what shoud I to if I want to have the character I typed and then 
call any sub?
I haven't tried this but I guess that you can signal_connect_after.

HTH, Dermot

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