PDA

View Full Version : String Control Max Length/Filtered Input and forcing case



MadBeardMan
May 13th, 2018, 10:03
Greetings All,

I've been working on the Worlds Data for the Traveller ruleset and I need a String Control to be restrictive (if possible0.

Are you able to specify a Max Number of characters (a Max Length)?
Are you able to filter the input, to say, 0-9, A-E (hex)
Are you able to force the text to uppercase as part of the input (I know I can do this onValueChanged)

None of these are essential, just nice to have.

Cheers,
MBM

Trenloe
May 13th, 2018, 16:44
All of this would have to be done as part of the onValueChanged event - or if user's were typing in data, you could possible use onChar: https://www.fantasygrounds.com/refdoc/textbasecontrol.xcp#onChar The latter can be used if the control has the <delaykeyupdate /> tag (which delays firing of the event functions until the control loses focus). There is no control properties that can be set to provide these functions, they need to be coded in LUA. You could program all of these restrictions in LUA using the relevant event/s and create a control template for re-use.

MadBeardMan
May 13th, 2018, 18:10
All of this would have to be done as part of the onValueChanged event - or if user's were typing in data, you could possible use onChar: https://www.fantasygrounds.com/refdoc/textbasecontrol.xcp#onChar The latter can be used if the control has the <delaykeyupdate /> tag (which delays firing of the event functions until the control loses focus). There is no control properties that can be set to provide these functions, they need to be coded in LUA. You could program all of these restrictions in LUA using the relevant event/s and create a control template for re-use.

As usual, cheers chap.

I am using onValueChanged, it's working nicely if I play nicely, ie don't enter in any rubbish data. I'll take a look at the onChar though later that seems to be the thing I'm looking for (a lot like a droid).

Anyways, dinner time here.

Cheers!