I guessed the silence is that there isn't any support for this. So I
wrote a subclass of PopupPanel that responds to keyboard events. It
would be nice to navigate popup menus with arrow keys but I can live
with shortcuts.

public class PopupPanelWithKeyboardShortcuts extends PopupPanel {

    private HashMap<Character, Command> keyCommandMap =
        new HashMap<Character, Command>();

    public PopupPanelWithKeyboardShortcuts(boolean autoHide) {
        super(autoHide);
    }

    @Override
    public boolean onKeyPressPreview(char key, int modifiers) {
        Command command = keyCommandMap.get(key);
        if (command != null) {
            command.execute();
        };
        hide();
        return super.onKeyPressPreview(key, modifiers);
    }

    public void addKeyCommand(Character character, Command command) {
        keyCommandMap.put(character, command);
    }

}

On Nov 25, 10:39 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Greetings,
>
> I've been successfully using a PopupPanel with a MenuBar as its
> widget. However it doesn't seem to be accessible via the keyboard.
> I've 
> readhttp://code.google.com/p/google-web-toolkit-doc-1-5/wiki/DevGuideAcce....
> I've tried wrapping the MenuBar in a FocusPanel but it seems to have
> no effect.
>
> Any suggestions?
>
> Thanks in advance,
>
> -ken
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to