Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: GetEvent with pre-existing Win32 window.  (Read 4565 times)

0 Members and 1 Guest are viewing this topic.

Imbue

  • Full Member
  • ***
  • Posts: 104
    • View Profile
GetEvent with pre-existing Win32 window.
« on: December 31, 2009, 08:39:18 am »
If I make a sf::RenderWindow using a pre-existing Win32 window, what do I need to do in order for GetEvent() to work? Is it possible?

Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GetEvent with pre-existing Win32 window.
« Reply #1 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.
Laurent Gomila - SFML developer

Imbue

  • Full Member
  • ***
  • Posts: 104
    • View Profile
GetEvent with pre-existing Win32 window.
« Reply #2 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, 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GetEvent with pre-existing Win32 window.
« Reply #3 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 ;)
Laurent Gomila - SFML developer

Imbue

  • Full Member
  • ***
  • Posts: 104
    • View Profile
GetEvent with pre-existing Win32 window.
« Reply #4 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GetEvent with pre-existing Win32 window.
« Reply #5 on: January 01, 2010, 12:57:22 pm »
Maybe a special flag to enable keyboard focus on your frame (Qt does this, for example)?
Laurent Gomila - SFML developer

 

anything