Do all the System::injectKeyBlah or injectMouseBlah functions fire an event?
If so, what event? I cannot seem to locate any event to subscribe to for having the Escape key pressed down. It is being injected with:
CEGUI::System::getSingleton().injectKeyDown(CEGUI::Key::Escape);
Does injectKeyBlah fire an event?
Moderators: CEGUI MVP, CEGUI Team
Re: Does injectKeyBlah fire an event?
Only the window with input focus gets the event. If you want to globally react to Escape key, you have to handle it separately (most likely at the same place where you inject Escape key)
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Does injectKeyBlah fire an event?
Version information is required here. In 0.7.x and later, events will propagate up towards the root only stopping if either something handles the event (such as a user subscribed function) or if the event reaches an editbox (the fact that an editbox will stop propagation of all key events in all cases is not 100% correct behaviour and will be addressed.)
CE
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Does injectKeyBlah fire an event?
0.7.5 is the version I'm using.
And in that case... what event would I need to subscribe to? I've searched through the Events for a number of classes, including Window and System, but found nothing that would let me subscribe to a Escape Key Pressed event. Sadly, the prophetic part of my brain wasn't working, because none of my guess worked either...
CEGUI::WindowManager::getSingleton().getWindow("testWindow")->subscribeEvent(<Random Guess Here>, CEGUI::Event::Subscriber(&killer::onPress, this));
What would I fill in for Random Guess Here?
And in that case... what event would I need to subscribe to? I've searched through the Events for a number of classes, including Window and System, but found nothing that would let me subscribe to a Escape Key Pressed event. Sadly, the prophetic part of my brain wasn't working, because none of my guess worked either...
CEGUI::WindowManager::getSingleton().getWindow("testWindow")->subscribeEvent(<Random Guess Here>, CEGUI::Event::Subscriber(&killer::onPress, this));
What would I fill in for Random Guess Here?
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Does injectKeyBlah fire an event?
Based on what you've said, I think in this case CEGUI::Window::EventKeyDown would suffice - if it doesn't work, I would check for active CEGUI::Editbox or CEGUI::MultiLineEditbox entities.
Failing this, check the list of all events available to all Window based items: http://cegui.org.uk/docs/current/classC ... 43c8b245a9
CE
Failing this, check the list of all events available to all Window based items: http://cegui.org.uk/docs/current/classC ... 43c8b245a9
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Does injectKeyBlah fire an event?
Ah, yes. That led me to the right answer. Thank you!
I had tried EventKeyDown, but of course that works for more than one key. Had to figure out how to cast the EventArgs in order to access the scancode of the key pressed.
I had tried EventKeyDown, but of course that works for more than one key. Had to figure out how to cast the EventArgs in order to access the scancode of the key pressed.
Who is online
Users browsing this forum: No registered users and 16 guests