[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: Text editing shortcut keys and menu shorcuts
From:       Havoc Pennington <rhp () zirx ! pair ! com>
Date:       1999-07-05 21:48:49
[Download RAW message or body]


On Mon, 5 Jul 1999, Fredrik Andersson wrote:
> 
> I have a menu in my program that uses shortcut keys but when the focus
> is on the enry box the problems start, lets say that I have a menu
> shortcut Alt+F but when in the entrybox that shortcut move the text
> cursor. So in this case the menu item does not get triggerd.
> 

This should only happen when the entry has the focus, and it would be
broken for accelerators to fire when users are trying to type in the text
entry. So the cure is probably worse than the disease. (If all else fails,
just choose different accelerators.)

If you want to break the GtkEntry bindings, you need to prevent the
default key press handler defined in gtkentry.c from being run. To do this
you should first understand the signal emission process; see
http://www106.pair.com/rhp/gnome-app-devel.html for some stuff on this.
Then you need to know that key events are dispatched from the key press
event handler in gtkwindow.c; have a look at that. You can probably do
something like connect a handler to the entry and then
gtk_signal_emit_stop_by_name() the key press signal.

However, in the future GtkEntry will probably use bindings (gtkbindings.h)
and then your code will break. It's sort of fragile to do it this way.
When GtkEntry uses bindings though it will be easier to do what you want
(via gtk_binding_entry_clear()). 

Havoc





-- 
         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
                       "unsubscribe" as the Subject.

	Mailing list concerns should be mailed to <listmaster@redhat.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic