SFML community forums

Help => Window => Topic started by: Imbue on December 31, 2009, 08:39:18 am

Title: GetEvent with pre-existing Win32 window.
Post by: Imbue on December 31, 2009, 08:39:18 am
If I make a sf::RenderWindow using a pre-existing Win32 window (http://www.sfml-dev.org/tutorials/1.6/graphics-win32.php), what do I need to do in order for GetEvent() to work? Is it possible?

Thanks.
Title: GetEvent with pre-existing Win32 window.
Post by: Laurent on December 31, 2009, 11:38:19 am
It works, SFML subclasses the existing window so that it catches its events before they arrive to your own event callback.
Title: GetEvent with pre-existing Win32 window.
Post by: Imbue on December 31, 2009, 09:32:31 pm
OK, thanks for your reply.

I am still having some trouble getting it to work though.

What I am doing is making a frame using the TK toolkit (http://www.tkdocs.com/), and then passing the HWND of the frame to sf::RenderWindow. Rendering works fine, and the mouse up/down/move events work fine. The resize and close events also seem to work.

My problem is that I am not receiving any keyboard or mouse wheel events.

I'll keep working on it, I'm sure I'm just making some stupid mistake.
Title: GetEvent with pre-existing Win32 window.
Post by: Laurent on January 01, 2010, 02:23:18 am
It can sometimes be tricky, callbacks may stop propagation of an event for some reasons. If SFML's events don't work, you can still use TK's ones ;)
Title: GetEvent with pre-existing Win32 window.
Post by: Imbue on January 01, 2010, 02:42:15 am
Yeah. I've been using Winspector to see window messages. Somehow the frame isn't even getting the messages, so this is in no way SFML's fault.

I'm just hoping there is some TK setting that will fix it. Hmmm.
Title: GetEvent with pre-existing Win32 window.
Post by: Laurent on January 01, 2010, 12:57:22 pm
Maybe a special flag to enable keyboard focus on your frame (Qt does this, for example)?