gianfun Posted July 10, 2007 Share Posted July 10, 2007 I would like to know if it is possible to set a minimum/maximum number of digits/numbers when typing into a input box? if i put GUICreate("Test",200,200) GUICtrlCreateInput("",100,100) and i want it to be from 6-8 digits. is there a way? thanks ps. i did search for it, but didnt find anything. probably searched wrong XD My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote] Link to comment Share on other sites More sharing options...
BrettF Posted July 10, 2007 Share Posted July 10, 2007 I would like to know if it is possible to set a minimum/maximum number of digits/numbers when typing into a input box? if i put GUICreate("Test",200,200) GUICtrlCreateInput("",100,100) and i want it to be from 6-8 digits. is there a way? thanks ps. i did search for it, but didnt find anything. probably searched wrong XDMaybe... GUICtrlSetLimit ( controlID, max [, min] ) Hope it helps, Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
enaiman Posted July 11, 2007 Share Posted July 11, 2007 (edited) Yep - Bert give you the solution fo it ... but you should be aware that: (from Help) Parameters controlID: The control identifier (controlID) as returned by a GUICtrlCreate... function. max: For List controls it is the extent you can scroll horizontally in pixels. For Input/Edit controls it is the max number of characters that can be entered. min: [optional] For Slider and UpDown controls you can specify a min value. .. you can use that "min" only for Slider and UpDown controls and not for Inputboxes (only max limit works there) Edited July 11, 2007 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
gianfun Posted July 11, 2007 Author Share Posted July 11, 2007 what a pity, i wanted it to be an exact number of digits long:( but the GUICtrlSetLimit ( controlID, max [, min] ) is good enough. thanks Bert and enaiman My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote] Link to comment Share on other sites More sharing options...
BrettF Posted July 11, 2007 Share Posted July 11, 2007 Yep - Bert give you the solution fo it ... but you should be aware that: (from Help) .. you can use that "min" only for Slider and UpDown controls and not for Inputboxes (only max limit works there)Hehehehee.... Opps. My Bad what a pity, i wanted it to be an exact number of digits long:( but the GUICtrlSetLimit ( controlID, max [, min] ) is good enough. thanks Bert and enaimanYou could test the input?? #Include <GUIConstants.au3> $gui = GUICreate("Test",200,200) $input = GUICtrlCreateInput("",10,10, 180) $button = GUICtrlCreateButton ("Test Input", 70, 35, 60) GUICtrlSetLimit ($input, 8, 6) GUISetState () While 1 $msg = GuiGetMsg () Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button _TestInput (GUICtrlRead($input)) EndSelect WEnd Func _TestInput ($input) $len = StringLen ($input) If $len > 5 and $len < 9 Then Msgbox (0, "String OK", "") EndIf EndFunc Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
gianfun Posted July 16, 2007 Author Share Posted July 16, 2007 THANKS !! My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote] 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