Guest smccauslin Posted March 29, 2005 Share Posted March 29, 2005 I'm trying to create an input box where the length of the input must be four numerical characters (0000 - 9999). I'm not really sure where the validation should happen. Specifically I am wondering: Can I check the input as the person types so that only 0-9 is accepted in each position or can it only be validated after the field is exited? How can I restrict the length? Ideally, I'd also like to echo the input to a greyed out box in the same window. I'll actually have 2 boxes on the window and the input will be combined to make one string. It would be good if the person entering the data could see the whole string to verify that it is correct. As an example Input box 1: 8765 Input box 2: This is a test would result in a greyed out box that contains: 8765 - This is a test I'd appreciate any direction and guidance you may be able to give. Thanks! Link to comment Share on other sites More sharing options...
buzz44 Posted March 29, 2005 Share Posted March 29, 2005 #include <GUIConstants.au3> GUICreate("Test") $test1 = GUICtrlCreateInput ( "0000", 2, 2,40,-1,$ES_NUMBER) $test2 = GUICtrlCreateInput ( "This is a test", 2, 30,70,-1) $test3 = GUICtrlCreateLabel ( "text", 100, 2, 100, -1) GUISetState() $changed = GUICtrlRead ($test3) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If GUICtrlRead ($test1) > 9999 Then GUICtrlSetData ($test1, "9999") EndIf If $changed <> GUICtrlRead ($test1) & " - " & GUICtrlRead ($test2) Then GUICtrlSetData ($test3, GUICtrlRead ($test1) & " - " & GUICtrlRead ($test2)) EndIf $changed = GUICtrlRead ($test3) Wend Try that, just whipped it up... should get u started =) qq Link to comment Share on other sites More sharing options...
Guest smccauslin Posted March 29, 2005 Share Posted March 29, 2005 Thanks! This is a big help. I've a long way to go but this definitely put me on the right track. Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 29, 2005 Share Posted March 29, 2005 GuiCtrlSetLimit on the input control to make it so people can only type 4 numbers [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now