click on buttons when the view is changed

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

billarhos

Hi,
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
http://www.mediafire.com/file/d2nadgdqb9wstw9/Tgui.rar


sf::Uint8 alpha = 80;
HWND hwnd = mWindow.getSystemHandle();
SetWindowLongPtr(hwnd, GWL_EXSTYLE, (GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_OVERLAPPEDWINDOW) | WS_EX_LAYERED);
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.

thanks






texus

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).

billarhos

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.

texus

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.

billarhos

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.

billarhos

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

Cheers

texus

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.