Page 1 of 1

Modal focus

Posted: Tue Aug 05, 2008 21:04
by dewyatt
I'm having a bit of trouble with my modal dialogs.
Code:

Code: Select all

mDialog_1->setVisible(true);
mDialog_1->setModalState(true);
mDialog_2->setVisible(true);
mDialog_2->setModalState(true);

Event handler for both (EventCharacterKey):

Code: Select all

bool onDialog_Character(const CEGUI::EventArgs& e)
{
const CEGUI::KeyEventArgs& Args = static_cast<const CEGUI::KeyEventArgs&>(e);
if (Args.codepoint != L' ')
   return true;

mDialog_1/2->setVisible(false);
mDialog_1/2->setModalState(false);
return true;
}

The problem is, after pressing space (which calls the above method), the dialog is closed, but the focus does not go to the window below.
So I have to click on the dialog before pressing space to close it.
This is not what I want, I need to be able to just press space through all the dialogs.

Is there a way to do this without maintaining some sort of stack in my app?

EDIT: Actually, I think I'm going to have to maintain a stack anyways for an unrelated reason but I'd still like to know what's up with this.

Posted: Wed Aug 06, 2008 08:19
by CrazyEddie
This reply is basically to just confirm that you have not missed anything; the system does not do any auto-activation of some other window when closing / destroying the window that is active.

CE.

Posted: Wed Aug 06, 2008 14:56
by dewyatt
Okay, I understand.