DarkBoost Posted February 9, 2009 Posted February 9, 2009 Is there a function that allows you to change the CreateUpDown number format to 01, 02, 03 instead of 1, 2, 3 etc. ? Here is the example from the help file #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $title, $input, $updown, $msg $title = "My GUI UpDown" GUICreate($title, -1, -1, -1, -1, $WS_SIZEBOX) $input = GUICtrlCreateInput("2", 10, 10, 50, 20) $updown = GUICtrlCreateUpdown($input) ; Attempt to resize input control GUICtrlSetPos($input, 10, 10, 100, 40) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd MsgBox(0, "Updown", GUICtrlRead($input)) EndFunc ;==>Example
DarkBoost Posted February 9, 2009 Author Posted February 9, 2009 (edited) I can obviously code it to do this, just wondering if there was already a built-in function? #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("",120,140) $editbox = GUICtrlCreateEdit("",10,10,100,100,$WS_VSCROLL) $button = GUICtrlCreateButton("GO",60,115,50,21) $input = GUICtrlCreateInput("",10,115,40,20) GUICtrlCreateUpdown($input) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $button If GUICtrlRead($input) = "1" Or GUICtrlRead($input) = "01" Then GUICtrlSetData($editbox, "01"&@CRLF,1) If GUICtrlRead($input) = "2" Or GUICtrlRead($input) = "02" Then GUICtrlSetData($editbox, "02"&@CRLF,1) If GUICtrlRead($input) = "3" Or GUICtrlRead($input) = "03" Then GUICtrlSetData($editbox, "03"&@CRLF,1) If GUICtrlRead($input) = "4" Or GUICtrlRead($input) = "04" Then GUICtrlSetData($editbox, "04"&@CRLF,1) If GUICtrlRead($input) = "5" Or GUICtrlRead($input) = "05" Then GUICtrlSetData($editbox, "05"&@CRLF,1) If GUICtrlRead($input) = "6" Or GUICtrlRead($input) = "06" Then GUICtrlSetData($editbox, "06"&@CRLF,1) If GUICtrlRead($input) = "7" Or GUICtrlRead($input) = "07" Then GUICtrlSetData($editbox, "07"&@CRLF,1) If GUICtrlRead($input) = "8" Or GUICtrlRead($input) = "08" Then GUICtrlSetData($editbox, "08"&@CRLF,1) If GUICtrlRead($input) = "9" Or GUICtrlRead($input) = "09" Then GUICtrlSetData($editbox, "09"&@CRLF,1) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Edited February 9, 2009 by DarkBoost
DarkBoost Posted February 9, 2009 Author Posted February 9, 2009 Not sure if I am reinventing the wheel with this script #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("",120,140) $editbox = GUICtrlCreateEdit("",10,10,100,100,$WS_VSCROLL) $button = GUICtrlCreateButton("GO",60,115,50,21) $input = GUICtrlCreateInput("",10,115,40,20) GUICtrlCreateUpdown($input) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $button $inputread = GUICtrlRead($input) If $inputread <= 9 Then If $inputread = "1" Or $inputread = "01" Then GUICtrlSetData($editbox,"01"&@CRLF,1) If $inputread = "2" Or $inputread = "02" Then GUICtrlSetData($editbox,"02"&@CRLF,1) If $inputread = "3" Or $inputread = "03" Then GUICtrlSetData($editbox,"03"&@CRLF,1) If $inputread = "4" Or $inputread = "04" Then GUICtrlSetData($editbox,"04"&@CRLF,1) If $inputread = "5" Or $inputread = "05" Then GUICtrlSetData($editbox,"05"&@CRLF,1) If $inputread = "6" Or $inputread = "06" Then GUICtrlSetData($editbox,"06"&@CRLF,1) If $inputread = "7" Or $inputread = "07" Then GUICtrlSetData($editbox,"07"&@CRLF,1) If $inputread = "8" Or $inputread = "08" Then GUICtrlSetData($editbox,"08"&@CRLF,1) If $inputread = "9" Or $inputread = "09" Then GUICtrlSetData($editbox,"09"&@CRLF,1) Else GUICtrlSetData($editbox,$inputread&@CRLF,1) EndIf Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd
wolf9228 Posted February 9, 2009 Posted February 9, 2009 GUICreate("",120,140) $editbox = GUICtrlCreateEdit("",10,10,100,100,$WS_VSCROLL) $button = GUICtrlCreateButton("GO",60,115,50,21) $input = GUICtrlCreateInput("",10,115,40,20) $Updown = GUICtrlCreateUpdown($input) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Updown GUICtrlSetData($input,"0" & GUICtrlRead($input)) Case $msg = $button GUICtrlSetData($editbox, GUICtrlRead($input)&@CRLF,1) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd صرح السماء كان هنا
wolf9228 Posted February 9, 2009 Posted February 9, 2009 or #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("",120,140) $editbox = GUICtrlCreateEdit("",10,10,100,100,$WS_VSCROLL) $button = GUICtrlCreateButton("GO",60,115,50,21) $input = GUICtrlCreateInput("",10,115,40,20) $Updown = GUICtrlCreateUpdown($input) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Updown if GUICtrlRead($input) < 10 Then _ GUICtrlSetData($input,"0" & GUICtrlRead($input)) Case $msg = $button GUICtrlSetData($editbox, GUICtrlRead($input)&@CRLF,1) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd صرح السماء كان هنا
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