[wxPython-users] The best way to jump around between 3 areas of program?

AK andrei.avk at gmail.com
Tue Mar 18 22:46:44 PDT 2008


Robin Dunn wrote:
> AK wrote:
>> Robin Dunn wrote:
>>> AK wrote:
>>>> Programs that have multiple panes usually have a shortcut to jump 
>>>> around them. For instance, Treepad uses ctrl-tab. But I already 
>>>> have flatNotebook in one pane, and ctrl-tab is also used for 
>>>> switching tabs. Is there a shortcut that's used in a few programs 
>>>> that's not ctrl-tab? For that matter, I couldn't find how to change 
>>>> it in flatnotebook.py. Is it using wx.EVT_NAVIGATION_KEY, it seems, 
>>>> but how then it knows if it's ctrl-tab or ctrl-alt-tab for reverse 
>>>> switch? There's event.GetDirection() call there, I feel like I'm a 
>>>> little lost. I'm thinking maybe I should use ctrl-right and 
>>>> ctrl-left to change tabs and ctrl-tab to cycle through 3 areas of 
>>>> the application. thanks! -ak
>>>>
>>>
>>> Depending on the platform and the widgets that are involved then you 
>>> may be able to just use tab to go through the whole UI, including 
>>> into and out of subpanels, etc.
>>>
>>>
>>>
>> That's no good because there's a lot of controls and it would be even 
>> slower than just using the mouse to tab 7 or 10 times to get 
>> somewhere.. I think as a rule of thumb, at least for my taste, if 
>> some action in the program is done very often, it should be possible 
>> to do with one keyboard shortcut..
>
> If you don't mind doing it with keys that are not getting stolen for 
> navigation events, then I would suggest using an acceleration table, 
> and in the event handlers just call SetFocus of the first widget in 
> the area that you want to be able to jump to.
>
I used Franz's code to turn off the notebook keys and did use an 
acceleration table to map to function that looks where the focus is and 
then goes to the first widget in those 3 areas. I think it's important 
to have default shortcuts that follow the way of least surprise. By the 
way, is it common in wxPython components to have shortcuts that are not 
easily changed? I was thinking ahead of possibility of making a shortcut 
setup dialog in the program, would that be really hard to do? Do 
most/all components follow some kind of standard way of changing 
shortcuts? thanks, -ak




More information about the wxpython-users mailing list