Keyboard input/focus questions

simed

09-06-2012 13:36:20

1)I have a Window which contains a Canvas control. I put mouse/key event handlers on the Canvas but only mouse handlers get called. Debugging into InputManager::injectKeyPress() & InputManager::injectKeyRelease() I see that mWidgetKeyFocus is actually the parent Window, but mWidgetMouseFocus is the Canvas as expected.

Can I easily fix this?

2)I noticed that even in 'official' MyGUI apps like the LayoutEditor, keyboard functionality is very limited... for instance the main menu-bar doesn't seem to accept keyboard at all? Is it possible to make MyGUI work more like traditional Windows environment for keyboard input e.g TAB between controls on a 'dialog'/window, shortcut keys, etc, etc.

If there's any previous reference on this that answer the questions already, links would be awesome!

rubiphisto

12-11-2012 16:20:46

Did you notice that the member variable in class WidgetInput is initialized by false? This variable determine whether the widget receive the key focus. Of course class WidgetInput is the base class of Widget. Finally, there is a pair of member function WidgetInput::setNeedKeyFocus and WidgetInput::getNeedKeyFocus.