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

Author Topic: no KeyEvents in wxWidget  (Read 3058 times)

0 Members and 1 Guest are viewing this topic.

uGhster

  • Newbie
  • *
  • Posts: 23
    • View Profile
no KeyEvents in wxWidget
« on: February 12, 2013, 10:24:01 pm »
Hi,
is it known that no KeyEvents are triggered when using SFML with wxWidget?
I am polling the event in a mainloop like this:

   sf::Event event;
   while (window.pollEvent(event))
   {
      if (event.type == sf::Event::KeyPressed) {
         LOG << "Yeah!\n";
      }
   }
 

however the polling the Keyboard directly is still possible.
Is there a workaround to get the KeyEvent working?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: no KeyEvents in wxWidget
« Reply #1 on: February 12, 2013, 10:52:41 pm »
It's known that events don't work 100% when SFML is embedded into another GUI framework. It depends on the GUI framework and on the OS, and I don't know exactly why. So the best solution in this case is to use the event system of the GUI framework.
Laurent Gomila - SFML developer

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: no KeyEvents in wxWidget
« Reply #2 on: February 12, 2013, 10:53:05 pm »
I haven't worked with wxWidget before. But in Qt you have to call setFocusPolicy(Qt::StrongFocus); in order for keyPressed events to be passed to SFML (take a look at the 1.6 tutoria). Maybe there is something similar for wxWidget.

uGhster

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: no KeyEvents in wxWidget
« Reply #3 on: February 12, 2013, 11:58:24 pm »
Tried wxPanel::SetFocus and wxPanel::SetFocusIgnoringChildren without any luck. So I had to go with the EventPipe of wxWidget for theese specific events.

Thanks for the quick answers  :D