SFML community forums

Help => Window => Topic started by: gokaysatir on September 20, 2015, 12:02:48 pm

Title: Is SFML Window Events Are Compatible WinForm Events
Post by: gokaysatir on September 20, 2015, 12:02:48 pm
Hi,

I am using sfml nearly for 3 years, and i love it=) I am not an active form member since i can find nearly all answers about sfml. Now i am stuck in a situation.

I moved my sfml window into a winform control, following the way described here:
http://en.sfml-dev.org/forums/index.php?topic=9141.0 (http://en.sfml-dev.org/forums/index.php?topic=9141.0)

It works, i only had to cast hwnd like this (for those who might look for solution):

HWND hwnd = (HWND)(splitContainer1->Panel2->Handle.ToInt32());

After moving SFML RenderWindow into winControl, i didn't change the pollEvents function calls. I use them like this:

while (sfRenderWindow->pollEvent(event)){
  switch (event.type){
  case sf::Event::Closed:{
  sfRenderWindow->close();
  break;
  }
case sf::Event::KeyPressed:{
break;
}...

But it gets the events mismatched. When i move the mouse, renderWindow gets a leftMouse press event i guess.

How i can prevent this, or what i did wrong, thanks  :)
Title: Re: Is SFML Window Events Are Compatible WinForm Events
Post by: zsbzsb on September 20, 2015, 12:11:08 pm
But it gets the events mismatched. When i move the mouse, renderWindow gets a leftMouse press event i guess.

Have you recently updated SFML? If so it sounds like you got mismatched header/lib files as SFML recently added a few new events.
Title: Re: Is SFML Window Events Are Compatible WinForm Events
Post by: gokaysatir on September 20, 2015, 12:22:11 pm
Thanks for the reply :)

Yes i updated the SFML libraries few days ago. But i didn't change the poll events calling functions.
Title: Re: Is SFML Window Events Are Compatible WinForm Events
Post by: gokaysatir on September 20, 2015, 12:25:10 pm
In addition: Your answer looks reasonable, i will check the libraries again now.
Title: Re: Is SFML Window Events Are Compatible WinForm Events
Post by: gokaysatir on September 20, 2015, 12:31:04 pm
Thanks a lot, i replaced dll files again. Now mouse wheel press event matches There is one more mismatched event, and i know where to look :)