Widget event will implement 2 times when one clike

planB

27-08-2010 00:28:14

hi, every one!

in my app, i use ogre_win32 framework and mygui 3.01.

when debug, if i clike widget like a created button, the event function will implement 2 times.

in static LRESULT CALLBACK _WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam), i don't inject any mygui mousepressed function,

and in the mousepressed funtion, i inject mygui mousepressed once.
bool BaseApp::mousePressed(const OIS::MouseEvent& evt, OIS::MouseButtonID id)
{
GUIManager::getGUI()->injectMousePress(evt.state.X.abs, evt.state.Y.abs, MyGUI::MouseButton::Enum(id));

if(checkWindowBound(evt) && AppStateManager::GetSingletonPtr()->size())
{
return AppStateManager::GetSingletonPtr()->peekTop()->mousePressed(evt,id);
}
return true;
}

Altren

27-08-2010 01:16:35

And what about mouse released? Do you inject it?
Also you not said what event you got twice. If it is eventMouseButtonClick, also try eventMouseButtonPressed/eventMouseButtonReleased and see if any also happens twice.

planB

27-08-2010 01:44:03

yes, i also inject mouse released once in the
bool BaseApp::mouseReleased(const OIS::MouseEvent& evt, OIS::MouseButtonID id)
{
GUIManager::getGUI()->injectMouseRelease(evt.state.X.abs, evt.state.Y.abs, MyGUI::MouseButton::Enum(id));

if(checkWindowBound(evt) && AppStateManager::GetSingletonPtr()->size())
{
return AppStateManager::GetSingletonPtr()->peekTop()->mouseReleased(evt,id);
}
return true;
}


at the moment, i use the eventMouseButtonClick, and it will implement twice.

when i use eventMouseButtonPressed, it's same as before.

in my ogre_win32 framework, i use below code,
while (!mShutDown)
{
Ogre::WindowEventUtilities::messagePump();

if (mRoot)
{
mRoot->renderOneFrame();
}
::Sleep(DELAY_SLICE);

}


does this code matter with mygui, or something else?

Altren

27-08-2010 14:50:21

Set breakpoint into called event and show two call stacks for each.