Game Development Community

Why would a GUI component not recieve onKeyDown?

by Thomas \"Man of Ice\" Lund · in Torque Game Engine · 02/05/2005 (5:18 am) · 6 replies

For the new flash gui I'm trying to get keyboard events into the flash movie.

The code is all set, keymap translation is done - but I never recieve onKeyUp() or onKeyDown() events.

Would anyone have any clue why this is?

#1
02/05/2005 (1:24 pm)
If another GUI is laying over the flash one, it will recieve the input calls. This is something that has cropped up when working with guis in the RTS SK, and it might be the origin of your problem.
#2
02/05/2005 (1:36 pm)
The message hud is notorious for this, since it grabs roughly 1/3 to 1/4 of the upper left corner of the screen, and isn't normally in the gui control ancestry tree either. Took me at least a month early on to discover what was going on.

You may also want to check various "first responder" settings?
#3
02/05/2005 (2:32 pm)
Thanks - will try to check if any other components are on top.
#4
02/06/2005 (8:42 pm)
Also, check the "profile" of the component. I made a custom one (subclassed of GuiControl) with a profile of GuiDefaultProfile. My control did not receive keyboard input. After changing the profile to GuiTextEditProfile, I began getting the events.
#5
02/10/2005 (3:12 am)
Yup, the first responder stuff is key to routing keydown/up events. There is an entry in the GuiControlProfile which controls this, and you may need to call some methods on the GuiControl itself to get stuff working right.
#6
07/18/2006 (4:00 am)
How do you assign "first responder" status in script? Some GUI objects are problematic as they are controls that are not easily clicked upon.