click on buttons when the view is changed
« on: 29 March 2018, 21:54:40 »
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

Code: [Select]
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

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: click on buttons when the view is changed
« Reply #1 on: 29 March 2018, 22:08:51 »
That is indeed really weird.

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

Re: click on buttons when the view is changed
« Reply #2 on: 29 March 2018, 22:34:06 »
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

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: click on buttons when the view is changed
« Reply #3 on: 29 March 2018, 22:41:05 »
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.

Re: click on buttons when the view is changed
« Reply #4 on: 29 March 2018, 23:00:41 »
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.

Re: click on buttons when the view is changed
« Reply #5 on: 30 March 2018, 00:21:15 »
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

  • *****
  • 1248
    • View Profile
    • Texus's Blog
Re: click on buttons when the view is changed
« Reply #6 on: 30 March 2018, 08:09:17 »
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.