Page 1 of 1

How to control string gadget length

Posted: Fri Jun 27, 2003 7:15 pm
by soswing
I'm a newbie to Pure Basic.
Can anybody help me how to control the max length of a string gadget?
What I mean: If I want to have an input for example max. 4 characters,
is there any solution to allow only 4 charecters to be keyed in.
It is not the way, that I check the length after the user made an
input of 23 characters, then I warn him: only 4 characters are allowed.
I want to make a possibility to input only 4 characters on the
windows screen.

Thanks,

soswing

Posted: Fri Jun 27, 2003 7:36 pm
by Pupil
I think that for now you have to use the API to do this, on WinOS platforms you use this:

Code: Select all

SendMessage_(GadgetID(#YOUR_STRING_GADGET), #EM_LIMITTEXT, 4, 0)
; where 4 is the char limit you set

How to control string gadget length

Posted: Fri Jun 27, 2003 8:02 pm
by soswing
Thanks Pupil,

It works fine!! :D

soswing