lyledg Posted November 30, 2004 Posted November 30, 2004 I have read in the helpfile that with the "InputBox" Ctrl, and I quotePutting an M after the first character indicates that input is Manditory; i.e. you must enter something. Nothing will happen if you press the Ok button when there is nothing in the InputBox." Example : ;Asks the user to enter a 1 or 2 character response. The <b>M</b> in the password field indicates that blank string are not accepted and the 2 indicates that the response will be at most 2 characters long.$value = InputBox("Testing", "Enter the 1 or 2 character code.", "", " M2")Does the GUICtrlCreateInput have the same functionality?Basically, I want to create a few input boxes which do not accept blank strings. If there is an easier way to do this please feel free to teach me Cheers guys
CyberSlug Posted December 1, 2004 Posted December 1, 2004 Basically you just check If GuiRead($yourInputCtrl) = "" Only do something when that result is not an empty string... Here's an overly complete example:#include <GuiConstants.au3> GuiCreate("Testing", 251, 161, -1, -1, 0x94CC0A4C, 0x00050100) GUICtrlCreateLabel("Enter the 1 or 2 character code", 10, 10, 223, 91) $input = GUICtrlCreateInput("", 10, 96, 223, 20) GUICtrlSetLimit(-1, 2);limit text to two charcters GuiCtrlSetState(-1, $GUI_FOCUS) $okay = GUICtrlCreateButton("OK", 28, 121, 75, 23) $cancel = GUICtrlCreateButton("Cancel", 140, 121, 75, 23) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE or $msg = $cancel Then ExitLoop ElseIf $msg = $okay Then If GuiRead($input) <> "" Then MsgBox(4096,"Done", "Input Accepted!") ExitLoop EndIf EndIf Wend Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
lyledg Posted December 1, 2004 Author Posted December 1, 2004 (edited) Thanks for the reply Cyberslug! I understand now and have implemented successfully into my script, and other actions.. I have to say, the fact that you and others take the time to reply to guys like me still learning the ropes, really makes Autoit enjoyable and appealing to use. Once again many thanks, you have helped me heaps with your knowledge!!! Cheers mate Edited December 1, 2004 by lyledg
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