Re: Really global accelerators ?
- From: Pedro Caria <pmiguel maquina com>
- To: Paolo Molaro <lupus ximian com>
- Cc: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Really global accelerators ?
- Date: 19 Nov 2001 11:51:13 +0000
On Sun, 2001-11-18 at 21:55, Paolo Molaro wrote:
I can't seem to find a way to have an accelerator that works all the
time...
My problem: I want to use ctrl-w to activate something in my program,
but if the focus is in a GtkEntry, ctrl-w is bound to kill word... is
there any way around this ?
A key event is first sent to the toplevel window: you should be able to
handle it there, if that doesn't work, your code doesn't do the right
things.
Any ideias of what I could be doing wrong ?
I'm doing something like this...
my $win_browser = new Gtk::Window();
$self->{_mainwindow} = $win_browser;
$self->{_accelgroup} = new Gtk::AccelGroup;
$win_browser->add_accel_group($self->{_accelgroup});
(...)
$self->{'_accelgroup'}->add(ord('s'),'mod1-mask',0,$self->{'sair'},'clicked');
now this particular key combination always works (alt-s) but if I try
ctrl-w it wont work if I'm in a GTK::Entry...
Anyway, there is also another way to get keyboard events before Gtk
sends them to the widgets:
Gtk->key_snooper_install (\&handler);
with:
sub handler {
my ($widget, $gdkevent, @args) = @_;
#return 1; # if we want to handle the key event ourselves
return 0;
}
Yes, this could work as a way to intercept a key that I don't want going
to a widget, but is there a way to redirect the event to the proper
accelerator ?
ex:
sub handler {
my ($widget, $gdkevent, @args) = @_;
(...)
$accel_object->some_func($gdkevent);
return 1;
}
Thank You
Pedro Caria
(Maquina de Estados)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]