If edit box in focus

JezzaP

12-08-2009 18:32:33

Hello, thanks to all who posted on my previous two topics, was a great help.

I have this code:
bool cEditorListener::keyPressed( const OIS::KeyEvent &arg )
{
if (mpGUI->injectKeyPress(arg))return true;

Which stops keyPressed() being called properly if MyGUI is in focus. However, I would like the function to work if a button has jsut been pressed, but not if an edit box is in focus, because moving the camera whilst typing gets confusing. Is there an easy way to do this?

my.name

12-08-2009 22:32:51

bool cEditorListener::keyPressed( const OIS::KeyEvent &arg )
{
if (mpGUI->injectKeyPress(arg))
{
MyGUI::WidgetPtr focus = MyGUI::InputManager::getIstance().getKeyFocusWidget();
if (focus != nullptr && focus->castType<MyGUI::Edit>(false))
{
return true;
}
}

// your code

return true;
}

JezzaP

13-08-2009 13:01:45

Thank you!