Inactive button created under the mouse

Tiblanc

20-04-2009 02:53:40

I have some buttons on the screen and when I click on one of them, I call
mGUI->destroyAllChildWidget();

I then recreate my buttons with this code
button = mGUI->createWidget<MyGUI::Button>("Button",100, 240, 200, 26, MyGUI::Align::Bottom | MyGUI::Align::Center, "Main", "New_Game_Button");
button->setCaption("New Game");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenuState::mousePressed);


The button under the mouse cursor is inactive until I move the mouse, at which point it behaves normally. If I click before moving the mouse, nothing happens. It also does not change its appearance like it should when the mouse is over the button.

It seems to me the GUI isn't updated with the mouse position after the button is created. It's a minor problem, but would be nice to fix. Is there a way to update the GUI as if the mouse moved?

I tried mGUI->injectMouseMove(0.0f, 0.0f, 0.0f);
but that reset the mouse cursor in the corner of the screen.

Thanks in advance!

Altren

20-04-2009 03:39:53

mGUI->injectMouseMove(/* real mouse position here */);I'll think about doing this inside gui at frame start after widgets creation/destroying.