Re: can_activate_acce
- From: muppet <scott asofyet org>
- To: justin+gnome dicatek com
- Cc: gtk-perl-list gnome org
- Subject: Re: can_activate_acce
- Date: Mon, 25 Jul 2005 21:36:40 -0400
On Jul 25, 2005, at 5:26 PM, justin+gnome dicatek com wrote:
I was under the impression that one should return FALSE to inhibit the
accelerator. (Although, there are several contradictory versions of
the
documentation.)
Well, i, too, was wrong.
The docs for the signal indeed say "returns: TRUE if the signal can
be activated."
But, in the code, the signal is created with the
_gtk_boolean_handled_accumulator, the same accumulator used for event
signals, which stops the signal emission when any handler returns TRUE.
The signal is a run-last signal, so the default handler, which
returns TRUE if the widget is visible, will override any return value
you give in a normal handler. Since it's run-last and returns TRUE
from a boolean-handled accumulator, connect_after is useless. Thus,
to return FALSE, you have to stop the signal emission in your
handler, like so:
$button->signal_connect (can_activate_accel => sub {
# stop the emission of this signal, so our return value is
used.
$button->signal_stop_emission_by_name ('can_activate_accel');
# allow the accelerator to fire iff the keyboard focus is not
# in the entry.
return $window->get_focus != $entry;
});
--
The door is locked. I tried to open it, but the lock is harder to
pick than a broken nose.
-- Sensei, on 'I, Ninja'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]