click on buttons when the view is changed

Started by billarhos, 29 March 2018, 21:54:40


i found a strange bug. Really can not say if this is sfml or tgui problem but is is happening on button widjets when changing size and view on sfml form
along with changing the alpha color of form.

here is the repro project

sf::Uint8 alpha = 80;
HWND hwnd = mWindow.getSystemHandle();
SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA);

if i use the above lines then when i hit the left button the signal goes to the right button and vice versa. Strange, isn't it?
Hope Texus u come with any idea.



That is indeed really weird.

Quoteif i use the above lines then when i hit the left button the signal goes to the right button and vice versa.
How did you test that the signal goes to the wrong place?
Did you try printing event.mouseButton.button inside your window.pollEvent loop when event.type == MouseButtonPressed?

You should try removing TGUI related code from the test project. If you still get the wrong events with just SFML then you know it is a problem with SFML and you should ask on the SFML forum. Otherwise I will have a look at this tomorrow (I can't test it right now, I'm not on windows).


I test the hitting by additing two breakpoint inside the "connect" signal functions of the two buttons. When i hit the 'back' button the program stops on the breakpoint into the
'ok' button and vice versa. Also, there are colors the down state in buttons ;D.


That is likely a TGUI bug then. I misinterpreted your explanation as the left mouse button event being send when the right mouse button is clicked and vice versa.


Sorry, texus it is not a tgui poblem. I am getting wrong mouse cordinates when changing the view. It is a sfml issue. Invastigating.

Sorry again.


Yes, it was my mistake, sorry again.

I should use "WS_EX_OVERLAPPEDWINDOW" style, since i was dealing with 'exstyles' and not "WS_OVERLAPPEDWINDOW".

This little silly mistake produce wrong mouse events. :o



The "wrong" mouse events are probably a "feature" in windows. I imagine that things like this could happen if part of the WS_OVERLAPPEDWINDOW number happens to be e.g. WS_EX_LAYOUTRTL.