vickerps Posted March 15, 2010 Posted March 15, 2010 Hello can anyone help me with a problem I am having with changing the limit range on a textbox basically I have set the text box to have a limit of 1 to 9 which is fine for POS. However for back office I want it to be 90 to 99 I can change the initial value by using GUICtrlSetData to 99 however when I then use the up-down arrows it reverts to a range of 1 to 9 again. How can update the new value for GUICtrlSetLimit? Hope this make sense expandcollapse popup#INCLUDE <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <UpdownConstants.au3> #include <ComboConstants.au3> ;Declaring Variables that yet have no value ;Creating Variables $Version = "Version 1" ;Version Control $AnwserFile = StringTrimRight(@ScriptName,3) & "ini";Name of Anwser File $WorkingFile = @ScriptDir & "\Config.working.ini" $TextColour = IniRead ($AnwserFile,"Settings","TextColour","0x000000") $NextButtonName = IniRead ($AnwserFile,"Settings","NextButtonName","Next") $PosType = IniRead ($AnwserFile,"Settings","postype","BackOffice|POS" ) $Postype_Default = IniRead ($AnwserFile,"Settings","Postype_Default","POS" ) $POSNo_Default = IniRead ($AnwserFile,"Settings","POSNo_Default","1") $POSNo_Range_Min = IniRead ($AnwserFile,"Settings","POSNo_Range_Min","1") $POSNo_Range_Max = IniRead ($AnwserFile,"Settings","POSNo_Range_Max","9") $iXPos = 0 $iYPos = 0 $iWidth=@DesktopWidth ;Used to create form IF @DesktopWidth =1024 Then $iHeight=768 ElseIF @DesktopWidth =800 Then $iHeight=600 Else Msgbox(0,"Screen Resolution","Please set the screen resolution to either 1024x768 or 800x600 to run this program") Terminate() Endif ; Creating the Gui(Form) Opt("GUICoordMode",1) $F = GuiCreate("",$iWidth,$iHeight,$iXPos,$iYPos,$WS_SYSMENU,$WS_EX_TOPMOST) GUICtrlSetState(-1,$GUI_DISABLE) $Lbl_Type = GUICtrlCreateLabel("&System Type:",10,140,100,20) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,12) $C_Pos = GUICtrlCreateCombo("",110,140,160,-1,$CBS_DROPDOWNLIST) GUICtrlSetFont(-1,10) GUICtrlSetData(-1,$postype,$Postype_Default) $Lbl_POSNo = GUICtrlCreateLabel("&POS Number:",110,180,100,20) GUICtrlSetBkColor($Lbl_POSNo,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($Lbl_POSNo,12) $I_POSNo = GUICtrlCreateInput($POSNo_Default,220,180,50,25) GUICtrlSetFont(-1,12) $I_POSNo_UpDown = GUICtrlCreateUpdown($I_POSNo,$UDS_ARROWKEYS+$UDS_WRAP) $I_POSNo_UpDown_SL = GUICtrlSetLimit (-1,$POSNo_Range_Max,$POSNo_Range_Min) GUISetState(@SW_SHOW,$F) WHILE 1 ; Creating an infinite loop $Msg=GUIGetMsg() IF $Msg = $C_Pos Then IF Guictrlread($C_Pos) = "BackOffice" Then GUICtrlSetData($Lbl_POSNo,"B/o Number") GUICtrlSetData($I_POSNo,"99") ElseIF Guictrlread($C_Pos) = "POS" Then GUICtrlSetData($Lbl_POSNo,"POS Number") GUICtrlSetData($I_POSNo,"1") ENDIF EndIf Switch $Msg Case $GUI_EVENT_CLOSE ;Actions to be carried out upon pressing the upper right X IniWrite($WorkingFile,"Shutdown","Abort","Yes"); write an entry to an ini file IF ProcessExists("OnScreenKeyboard.exe") Then ProcessClose("OnScreenKeyboard.exe") Terminate() ;Stops the script EndSwitch WEnd
Moderators Melba23 Posted March 15, 2010 Moderators Posted March 15, 2010 vickerps,Look at the ; <<<<<<<<<<<<<<< lines in this script: expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <UpdownConstants.au3> #include <ComboConstants.au3> ;Declaring Variables that yet have no value ;Creating Variables $Version = "Version 1" ;Version Control $AnwserFile = StringTrimRight(@ScriptName, 3) & "ini";Name of Anwser File $WorkingFile = @ScriptDir & "\Config.working.ini" $TextColour = IniRead($AnwserFile, "Settings", "TextColour", "0x000000") $NextButtonName = IniRead($AnwserFile, "Settings", "NextButtonName", "Next") $PosType = IniRead($AnwserFile, "Settings", "postype", "BackOffice|POS") $Postype_Default = IniRead($AnwserFile, "Settings", "Postype_Default", "POS") $POSNo_Default = IniRead($AnwserFile, "Settings", "POSNo_Default", "1") $POSNo_Range_Min = IniRead($AnwserFile, "Settings", "POSNo_Range_Min", "1") $POSNo_Range_Max = IniRead($AnwserFile, "Settings", "POSNo_Range_Max", "9") $BackOffice_Default = IniRead($AnwserFile, "Settings", "BackOffice_Default", "99") ; <<<<<<<<<<<<<<<< $BackOffice_Range_Min = IniRead($AnwserFile, "Settings", "BackOffice_Range_Min", "90") ; <<<<<<<<<<<<<<<< $BackOffice_Range_Max = IniRead($AnwserFile, "Settings", "BackOffice_Range_Max", "99") ; <<<<<<<<<<<<<<<< $iXPos = 0 $iYPos = 0 $iWidth = @DesktopWidth ;Used to create form If @DesktopWidth = 1024 Then $iHeight = 768 ElseIf @DesktopWidth = 800 Then $iHeight = 600 Else MsgBox(0, "Screen Resolution", "Please set the screen resolution to either 1024x768 or 800x600 to run this program") Terminate() EndIf ; Creating the Gui(Form) Opt("GUICoordMode", 1) $F = GUICreate("", $iWidth, $iHeight, $iXPos, $iYPos, $WS_SYSMENU, $WS_EX_TOPMOST) GUICtrlSetState(-1, $GUI_DISABLE) $Lbl_Type = GUICtrlCreateLabel("&System Type:", 10, 140, 100, 20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 12) $C_Pos = GUICtrlCreateCombo("", 110, 140, 160, -1, $CBS_DROPDOWNLIST) GUICtrlSetFont(-1, 10) GUICtrlSetData(-1, $PosType, $Postype_Default) $Lbl_POSNo = GUICtrlCreateLabel("&POS Number:", 110, 180, 100, 20) GUICtrlSetBkColor($Lbl_POSNo, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($Lbl_POSNo, 12) $I_POSNo = GUICtrlCreateInput($POSNo_Default, 220, 180, 50, 25) GUICtrlSetFont(-1, 12) $I_POSNo_UpDown = GUICtrlCreateUpdown($I_POSNo, $UDS_ARROWKEYS + $UDS_WRAP) GUICtrlSetLimit(-1, $POSNo_Range_Max, $POSNo_Range_Min) GUISetState(@SW_SHOW, $F) While 1 ; Creating an infinite loop $Msg = GUIGetMsg() If $Msg = $C_Pos Then If GUICtrlRead($C_Pos) = "BackOffice" Then GUICtrlSetData($Lbl_POSNo, "B/o Number") GUICtrlSetData($I_POSNo, "99") $I_POSNo_UpDown_SL = GUICtrlSetLimit($I_POSNo_UpDown, $BackOffice_Range_Max, $BackOffice_Range_Min) ; <<<<<<<<< ElseIf GUICtrlRead($C_Pos) = "POS" Then GUICtrlSetData($Lbl_POSNo, "POS Number") GUICtrlSetData($I_POSNo, "1") $I_POSNo_UpDown_SL = GUICtrlSetLimit($I_POSNo_UpDown, $POSNo_Range_Max, $POSNo_Range_Min) ; <<<<<<<<<<< EndIf EndIf Switch $Msg Case $GUI_EVENT_CLOSE ;Actions to be carried out upon pressing the upper right X IniWrite($WorkingFile, "Shutdown", "Abort", "Yes"); write an entry to an ini file If ProcessExists("OnScreenKeyboard.exe") Then ProcessClose("OnScreenKeyboard.exe") Exit ;Terminate() ;Stops the script EndSwitch WEndI have assumed you do want to hardcode the numbers, so you will need to add a few more lines to your ini file. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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