Re: can_activate_acce
- From: "muppet" <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: can_activate_acce
- Date: Fri, 22 Jul 2005 11:18:24 -0400 (EDT)
zentara said:
justin+gnome said:
If I understand the documentation correctly, one should be able to disable
the keyboard accelerator for a widget by connecting to the
can_activate_accel signal and returning false. This isn't working for me,
however.
Can someone tell me if I'm doing something wrong, or is there a bug in
gtk/gtk-perl? Example program below... using gtk 2.4.9 and gtk-perl 1.092,
typing a "b" in the text entry will click the button despite the
can_activate_accel handler.
Incidentally, i see the same thing with gtk+ 2.7.x.
Hi, this is how I got it working, however, I'm just learning myself. There
probably is a more elegant solution.
[ disable accelerator in entry's enter-notify ]
[ enable accelerator in entry's leave-notify ]
That assumes you're using the mouse, and will fail if you drive with the
keyboard. Would be better to use "focus-in-event" and "focus-out-event".
But, your suspicion is correct, it's just a kludge.
The can-activate-accel trick *should* be working, e.g.,
$button->signal_connect (can_activate_accel => sub {
# inhibit the accel by returning TRUE.
# the signal uses the same boolean-handled-accumulator
# as events; so returning TRUE from the handler should
# cause $button->can_activate_accel(...) to return FALSE.
#
# don't allow the accelerator to activate if we're typing
# in the entry.
return ($window->get_focus == $entry);
});
but no matter how i do that, even just using "sub {return TRUE}",
$button->can_activate_accel($id) returns TRUE. Even tried with a small C
program, and am confused by the results.
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]