Divert keypress from a textbox with enable=false (?) **SOLVED**

Started by Knox, Fri 11/06/2010 16:43:44

Previous topic - Next topic

Knox

Hi,

I have the exact same question as this person "rich" (check link below), way back in 2005. Its about how to divert keypresses away from a textbox so it can be used to simulate a mouse click instead.

Its for the savegame GUI, I have a savegame button and a textbox. Since the textbox is always visible, when you press the "return" key, the textbox processes the key press, however, Id rather the return key simulates clicking on the "savegame" button on the GUI.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20141.0

"Rich" in the thread above found the solution to the same problem Im having, however, if Im not mistaken, it seems to be pointing to something that is now obselete.

I tried setting the
Code: ags
txtBox.enabled = false 
upon pressing the return key in on_key_press but of course the textbox absorbs that key press before I can disable it so I cant disable the txtBox when the return key is pressed. :P

I have to admit Im not quite sure what function/process I can use to get around this (if its impossible, I can live without it I guess...just would be nice!)
--All that is necessary for evil to triumph is for good men to do nothing.

Dualnames

I think the TextBox.OnActivate function runs when you press return.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Knox

Well I found a way to get around the problem, not exactly what I wanted but its a close second.

I just put in rep_exec if the mouse is over the input box to enable it, if it isnt, disable the textbox...so pressing "return" will work like I want as long as the mouse isnt over the text input box  :P

--All that is necessary for evil to triumph is for good men to do nothing.

Dualnames

Quote from: general_knox on Sat 12/06/2010 18:40:34
Well I found a way to get around the problem, not exactly what I wanted but its a close second.

I just put in rep_exec if the mouse is over the input box to enable it, if it isnt, disable the textbox...so pressing "return" will work like I want as long as the mouse isnt over the text input box  :P



Oh, that's what you wanted? I had a textbox handler module made somewhere and posted somewhere.  :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk