I'm using some predefined accelerators connected with certain hot keys. Is it possible to temporarily disable them? I don't want to change the hot keys, in order not to confuse users. The accelerators are activated when typing into a combo box, which really is unacceptable.
Asked
Active
Viewed 535 times
12
-
What are you accelerators and what characters are you typing? – drahnr Apr 02 '14 at 09:31
-
It's not an issue anymore, but to ask your question the accelerator defined for main window connected pressing the "s" key with some functionality of the app. I was trying to somehow disable the shortcut for the time when the user is typing something into text box. – user3484510 Apr 03 '14 at 09:58
-
1Side note regarding the bounty: The question has "python" in the tags but as far as I'm concerned this is really a GTK+ question, so any language should be fine. – smheidrich Jan 24 '16 at 20:03
-
1Another note: **Please** disregard the "It's not an issue anymore" comment. It's not an issue anymore for them but the problem in general persists. – smheidrich Jan 30 '16 at 17:17
-
@user3484510 You should post your own answer to this (as it looks that others may have the same issue) – Tom Myddeltyn May 06 '16 at 17:32
2 Answers
2
I asked this again on the GTK+ mailing list and the people there had two suggestions that came with real-life implementations from their own projects (not linked here but you can check the thread if you want to see them):
- Intercept and handle all key presses, thus overriding GTK+'s normal mechanism and allowing you to make exceptions for your accelerators.
- Having a list of accelerators that you remove manually when a text editing widget gets focus, then add them again when the widget loses focus. In GTK+ 3 this is accomplished with
gtk_application_set_accels_for_action
.
In the thread I linked you can find example code for both approaches. The second approach even has an example in GTK+ 2 and one in GTK+ 3.

smheidrich
- 4,063
- 1
- 17
- 30
1
As far as I know you cannot disable them. They will receive any key stroke that is not consumed by the focused Window.

sorin
- 161,544
- 178
- 535
- 806