Default keyboard shortcuts (accelerators) on some widgets

55 views
Skip to first unread message

dario...@gmail.com

unread,
Sep 10, 2014, 6:09:01 AM9/10/14
to wxpytho...@googlegroups.com
I'm in the process of migrating a TreeCtrl to a DataViewCtrl, but I've noticed that DataViewCtrl has some predefined accelerators (keyboard shortcuts) that override those set for some main menu items only when the control is focused. In particular I've found Ctrl+f (opens a text search that by the way works in the demo but not in my implementation) and Ctrl+n (which only seems to move the focus down in the rows of items). TreeCtrl itself was responding to letter and number keys in a sort of live text search.

My question is: are these shortcuts documented somewhere (also possibly for other widgets)? I would like to ensure my menu shortcuts work regardless of where the focus is, and I wouldn't like to test each of them (they are dozens) on each widget (still dozens, which makes hundreds of possible combinations), and remember to do it every time I add a shortcut or a widget, so having a comprehensive list would let me know what key combinations to avoid.

Then, is there a way of disabling default accelerators in general? If not, what is the recommended way to override them one by one?

Thank you
Dario

Werner

unread,
Sep 10, 2014, 7:16:08 AM9/10/14
to wxpytho...@googlegroups.com
Hi Dario,

On 9/10/2014 12:09, dario...@gmail.com wrote:
> I'm in the process of migrating a TreeCtrl to a DataViewCtrl, but I've
> noticed that DataViewCtrl has some predefined accelerators (keyboard
> shortcuts) that override those set for some main menu items only when
> the control is focused. In particular I've found Ctrl+f (opens a text
> search that by the way works in the demo but not in my implementation)
I think this is wxPython demo shortcut and not specific to the
TreeCtrl. If you press ctrl+f the focus goes to the Demo Code tab and
you search within the code.

Werner

dario...@gmail.com

unread,
Sep 10, 2014, 7:22:26 AM9/10/14
to wxpytho...@googlegroups.com


Hi Werner,

I'm talking about the DVC_DataViewModel demo: make sure an item in the list is focused and then press Ctrl+f: the internal widget search will appear (in the bottom-right corner), not the Demo Code tab one.

Werner

unread,
Sep 10, 2014, 7:32:38 AM9/10/14
to wxpytho...@googlegroups.com
Hhm, not for me, I am on Windows with wxPython 3.0 classic or 3.0.1 Phoenix

What version of wxPython are you using and on what platform?

Werner

Dario Giovannetti

unread,
Sep 10, 2014, 7:42:49 AM9/10/14
to wxpytho...@googlegroups.com
--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/1sUPp766uXU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Uh I'm on Linux/GTK 2.24, I'm starting to think that it's a shortcut of the native GTK widget, however I've tested it on a native GTK application that uses a tree control, and Ctrl+f does show the same text search, but for example Ctrl+n normally activates the associated menu item (open a new window).

Dario Giovannetti

unread,
Sep 10, 2014, 7:43:40 AM9/10/14
to wxpytho...@googlegroups.com
...and I'm using wxPython 3.0.1 Phoenix

Nathan McCorkle

unread,
Sep 10, 2014, 1:43:34 PM9/10/14
to wxpytho...@googlegroups.com


On Wednesday, September 10, 2014 4:16:08 AM UTC-7, werner wrote:
> the control is focused. In particular I've found Ctrl+f (opens a text
> search that by the way works in the demo but not in my implementation)
I think this is wxPython demo shortcut and not specific to the
TreeCtrl.  If you press ctrl+f the focus goes to the Demo Code tab and
you search within the code.


When I open the demo directly, i.e. not through Main.py I don't get any ctrl-f or ctrl-n actions happening. 
I tried with 2.9.4, 3.0.0 and 3.0.1 all MSW all Classic all on Win7

Dario Giovannetti

unread,
Sep 14, 2014, 6:52:33 AM9/14/14
to wxpytho...@googlegroups.com
--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/1sUPp766uXU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thank you, I'm positive now that this behaviour comes from the native GTK widget that is used by the DataViewCtrl; by the way, also Ctrl+p (previous) is taken by the widget.

I may have found a hack to disable at least Ctrl+f, but I've opened another thread for that because I have a more generic question about it: https://groups.google.com/d/msg/wxpython-users/4nsv7x1DE-s/ljQHl9RTnuEJ
Reply all
Reply to author
Forward
0 new messages