It could probably be done but not without some modifications to the Form and 
Label classes. Form doesn't provide direct access to the field labels, and 
Label doesn't currently provide a way to underline a single character.

Could you perhaps add a tooltip to each field that shows the shortcut key? 

On Nov 5, 2010, at 9:30 PM, ocean ocean wrote:

> Alright that makes sense. If I wanted to make it so that the mnemonic for the 
> form field was underlined how difficult would that be? I imagine it'd mean 
> drawing my own form labels somehow that are created by the Form.label field?
> 
> On Fri, Nov 5, 2010 at 9:12 PM, Greg Brown <[email protected]> wrote:
> There's no automated way to do it, but it is pretty easy to do - just add a 
> key listener to the form (or some other ancestor) and set focus to whatever 
> form elements you want.
> G
> 
> 
> On Nov 5, 2010, at 7:43 PM, ocean ocean wrote:
> 
>> I may also have missed this in the tutorial but is it possible to set 
>> keyboard shortcuts to jump around different controls in a Form? I'm looking 
>> at the javadoc and nothing jumps out at me.
>> 
>> Thanks,
>> 
>> On Fri, Nov 5, 2010 at 7:19 PM, ocean ocean <[email protected]> wrote:
>> That's pretty cool. I do think it would be useful as my users are pretty big 
>> on keyboard navigability. Where did you put that code, in some sort of key 
>> listener on the frame itself?
>> 
>> 
>> On Fri, Nov 5, 2010 at 7:00 PM, Greg Brown <[email protected]> wrote:
>> Here's an example of how you might activate the menu in a key press handler. 
>> When the user presses Alt-Space and the menu is not currently active, the 
>> first menu is shown and the user can navigate the menu via keyboard:
>> 
>>         Frame frame = (Frame)component;
>>         MenuBar menuBar = frame.getMenuBar();
>>         
>>         if (menuBar != null
>>             && keyCode == Keyboard.KeyCode.SPACE
>>             && Keyboard.isPressed(Keyboard.Modifier.ALT)) {
>>             MenuBar.Item activeItem = menuBar.getActiveItem();
>>             MenuBar.ItemSequence items = menuBar.getItems();
>>             
>>             if (activeItem == null
>>                 && items.getLength() > 0) {
>>                 items.get(0).setActive(true);
>>             }
>>         }
>> 
>> I actually implemented this in TerraFrameSkin#keyPressed() - if you think it 
>> is useful, I can commit it.
>> 
>> G
>> 
>> On Nov 5, 2010, at 4:17 PM, Greg Brown wrote:
>> 
>>> What you are describing is called a mnemonic:
>>> 
>>>   http://msdn.microsoft.com/en-us/library/bb158536.aspx
>>> 
>>> There are no current plans to implement such a feature. However, it should 
>>> be easy enough to wire up a key event listener that will open the menu bar 
>>> - the user could use the arrow or tab keys to navigate the menu system from 
>>> there.
>>> 
>>> On Nov 5, 2010, at 4:10 PM, ocean ocean wrote:
>>> 
>>>> Not sure what you mean. I can create global keyboard shortcuts as 
>>>> described in the MenuBars tutorial. I mean ability to press 'Alt' and have 
>>>> that underline top-level menus, then press 'F' to pop open the File menu. 
>>>> So users can navigate the menu structure without reaching for the mouse. 
>>>> Just curious if this is something planned or not.
>>>> 
>>>> On Fri, Nov 5, 2010 at 4:06 PM, Greg Brown <[email protected]> wrote:
>>>> Windows-style mnemonics are not supported, but Mac-style keyboard 
>>>> shortcuts are. See the Menu Bars tutorial for more info.
>>>> 
>>>> On Nov 5, 2010, at 3:50 PM, ocean ocean wrote:
>>>> 
>>>>> I understand according to ( 
>>>>> http://mail-archives.apache.org/mod_mbox/pivot-user/201010.mbox/%[email protected]%3e
>>>>>  ) menu accelerators aren't built in yet. Keyboard navigability is pretty 
>>>>> important for my apps so I was just curious if this was in the plans...
>>>> 
>>>> 
>>> 
>> 
>> 
>> 
> 
> 

Reply via email to