Page 1 of 1

EditBox events

Posted: Thu Mar 06, 2008 13:14
by BayerMeister
:roll: I hope this is the right place to start a discussion about this

Events of the EditBox widget:

According to http://www.cegui.org.uk/wiki/index.php/EventGalore#Editbox there are no other events than the one, that is fired upon leaving the EditBox or pressing enter or tab. Now THAT is a pity.

I think it deserves more: A "charAccepted" upon each new caracter arrived (pressed) in particular. It is important to make a "mask" on the input.

Lets say I want to accept IPs only. If a character other than [0..9]+"." would arrive, I'd highlight some kinda warning. I can not do this without that event. Or am I mistaken?

Posted: Thu Mar 06, 2008 19:32
by CrazyEddie
Hi,

there are some other events specific to the editbox, these can be seen around this part of the API ref for Editbox.

Obviously you can see there is no 'charAccepted' event, although it may be possible to get something like what you want by setting an appropriate validation string (for the IP entry example maybe "[0-9.]*" or something), and responding to EventInvalidEntryAttempted to put up a message or something.

The above regex solution may not be ideal, since it will not enforce a strict IP format for entry, but it does allow you to do what you stated in the original example.

CE.

Posted: Sat Mar 08, 2008 18:15
by BayerMeister
Thanks, I see there's a lot more offered.

It is a bit off-topic, but I don't understand why EditBoxes don't take input from the numeric keyboard. Is there a reason for this?
I know I could take the sourcecode and observe it from the injection point, but... there are other things, too. Like the default look'n'feel - holding a key down in an EditBox does not start inserting more characters. Especialy the backspace needs this behaviour.
(I know one can select the whole text and delete wit one hit of bkspace, that is of little help though - a lot of BFUs will never know)

Posted: Sat Mar 08, 2008 23:42
by CrazyEddie
With regards to 'missing' inputs and auto-repeat - both of those issues are dependant upon the input library in use. For example, if the input library does not report the numeric keypad keys, or they are otherwise not injected into CEGUI, then CEGUI can not respond. It's a similar situation with auto-repeat - presently there is no 'built-in' auto repeat for keys, the repeated key strokes must come via your input lib.

CE.