Mouse events & ComboBox (possible bug)

Ripiz

26-12-2011 20:19:28

Hello,
I am using Visual Studio 2010 and MyGUI revision 4341 with DirectX 11 renderer.
Following code is used to send mouse events to MyGUI:
if(uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) {
if(uMsg == WM_MOUSEMOVE)
Handled += MyGUI::InputManager::getInstance().injectMouseMove(LOWORD(lParam), HIWORD(lParam), 0);
else {
if(uMsg == WM_LBUTTONDOWN)
Handled += MyGUI::InputManager::getInstance().injectMousePress(LOWORD(lParam), HIWORD(lParam), MyGUI::MouseButton::Button0);
else if(uMsg == WM_LBUTTONUP)
Handled += MyGUI::InputManager::getInstance().injectMouseRelease(LOWORD(lParam), HIWORD(lParam), MyGUI::MouseButton::Button0);
else if(uMsg == WM_RBUTTONDOWN)
Handled += MyGUI::InputManager::getInstance().injectMousePress(LOWORD(lParam), HIWORD(lParam), MyGUI::MouseButton::Button1);
else if(uMsg == WM_RBUTTONUP)
Handled += MyGUI::InputManager::getInstance().injectMouseRelease(LOWORD(lParam), HIWORD(lParam), MyGUI::MouseButton::Button1);
else if(uMsg == WM_MBUTTONDOWN)
Handled += MyGUI::InputManager::getInstance().injectMousePress(LOWORD(lParam), HIWORD(lParam), MyGUI::MouseButton::Button2);
else if(uMsg == WM_MBUTTONUP)
Handled += MyGUI::InputManager::getInstance().injectMouseRelease(LOWORD(lParam), HIWORD(lParam), MyGUI::MouseButton::Button2);
}
}

if(!Handled) {
// application input
}

However I noticed some issues, if I press on item in ComboBox and continue holding mouse button without moving mouse function MyGUI::InputManager::getInstance().getMouseFocusWidget() returns 0, therefore application processes mouse like it's not over GUI. I tried to make workaround, by sending MouseMove event after mouse input:
else if(uMsg == WM_MBUTTONUP)
// ...
if(Handled)
Handled += MyGUI::InputManager::getInstance().injectMouseMove(LOWORD(lParam), HIWORD(lParam), 0);

And it did work, however new issues appeared; if there's a button under where I clicked, releasing mouse presses the button behind it, for example ( http://img847.imageshack.us/img847/8199/92293149.png ), if you press on Dirt.dds or Grass1.dds it'll also click the button behind it.

So my question is, is this a bug, or I've handled input incorrectly?

Thank you in advance.

thierryg

06-01-2012 18:33:45

I must say I have exactly the same issue, and I don't know how to solve it.

I created a GUI, and check the getMouseFocusWidget to know if I'm clicking on the GUI or on the 3d Scene.
If I click on the 3D scene, I deselect every game objects, if I click on the GUI, I'm only using Gui features, as expected.

The problem is, when I click on a combox item I'm loosing the Mousefocus, and every objects are deselected, which is really annoying.
I have no problem with every other widget, though.

Any though ?
T.

Ripiz

09-01-2012 17:31:30

If you call injectMouseMove() after injectMousePress() it'll fix the problem. But you might encounter bug with button like I'm having.

Windows (probably other OS too) handles button press only if button was clicked on and released; MyGUI seems to send event when mouse was released over a button, you don't even need to click it.

Altren

10-01-2012 07:49:01

The problem is that ComboBox's popup list is handle mouse press event for some reason (instead of intended press + release), so I guess it leave mouse press event untouched somehow and dispatch it to next widget (button under it in your case). We will fix that soon.

P.S. No, you need to press to make button call it's event.

thierryg

27-02-2012 07:52:36

Just to know : is this issue fixed in the 3.2.0 release ?

Thanks !
T.

Altren

27-02-2012 12:44:49

No, not yet. Scheduled for 3.2.1

scrawl

01-10-2014 15:26:45

Didn't make it in 3.2.1, but it's fixed in the next release: https://github.com/MyGUI/mygui/commit/5 ... d8f1ed8685

thierryg

12-10-2014 14:03:26

Great news!
Thanks.

T.