BigDaddyO Posted March 14, 2007 Share Posted March 14, 2007 (edited) I have a script that is generating the limit values on the fly but when it gets to the same Min & Max it does not work. I have a little sample program below that shows my problem. Any ideas how to get it to lock the value if the Min & Max are the same? #include <GuiConstants.au3> Dim $Score[2], $updown[2] $GUIMain = GuiCreate("", 300, 160) $Y = 20 For $i = 0 to 1 $Score[$i] = GUICtrlCreateInput(3, 40, $Y, 40, 20, $ES_READONLY) $updown[$i] = GUICtrlCreateUpdown($Score[$i]) GUICtrlSetLimit($updown[$i], 3, 3) $Y = $Y + 40 Next $Close = GuiCtrlCreateButton("Close", 140, 50, 100, 30) $btnDelete = GUICtrlCreateButton("Delete", 140, 80, 100, 20) $btnCreate = GUICtrlCreateButton("Create", 140, 100, 100, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $btnDelete For $i = 0 to 1 GUICtrlDelete($updown[$i]) Next Case $msg = $btnCreate for $i = 0 to 1 $updown[$i] = GUICtrlCreateUpdown($Score[$i]) Next Case $msg = $GUI_EVENT_CLOSE or $msg = $Close ExitLoop Case Else ;;; EndSelect WEnd EDIT: Updated script to show another issue Thanks, Mike Edited March 14, 2007 by MikeOsdx Link to comment Share on other sites More sharing options...
BigDaddyO Posted March 14, 2007 Author Share Posted March 14, 2007 (edited) I found another strange thing with UpDown. If you delete the Updown control it resizes the input box it was assigned to, so if you delete and then re-recreate the UpDown later on, the box will be to small to see the numbers. Mike edit: hmmm..... maybe I should post this in the Bug forum Edited March 14, 2007 by MikeOsdx Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 14, 2007 Share Posted March 14, 2007 If you need do it just for two updowns, then maybe this will help (if i understand right what you need): #include <GuiConstants.au3> Opt("GuiOnEventMode", 1) $GUIMain = GuiCreate("", 300, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "Events") $Score1 = GUICtrlCreateInput(3, 40, 20, 40, 20, $ES_READONLY) $updown1 = GUICtrlCreateUpdown(-1) GUICtrlSetOnEvent(-1, "Events") GUICtrlSetLimit(-1, 3, 3) $Score2 = GUICtrlCreateInput(3, 40, 60, 40, 20, $ES_READONLY) $updown2 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 3, 3) GUICtrlSetOnEvent(-1, "Events") $Close = GuiCtrlCreateButton("Close", 140, 50, 100, 30) GUICtrlSetOnEvent(-1, "Events") GuiSetState() While 1 Sleep(100) WEnd Func Events() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE, $Close Exit Case $updown1 If GUICtrlRead($Score1) > GUICtrlRead($Score2) Then GUICtrlSetData($Score1, GUICtrlRead($Score1)-1) Case $updown2 If GUICtrlRead($Score2) > GUICtrlRead($Score1) Then GUICtrlSetData($Score2, GUICtrlRead($Score2)-1) EndSwitch EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
BigDaddyO Posted March 14, 2007 Author Share Posted March 14, 2007 (edited) My actual script is a lot more complicated than the sample script so being able to set the Min/Max to the same to lock the value would make my life a WHOLE LOT easier... Edited March 14, 2007 by MikeOsdx Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 14, 2007 Share Posted March 14, 2007 I don't sure if i understand you - (correct me if i wrong): you want that when user set the updown, and if the all updowns are equel, then just lock them (what you mean by lock? lock like i did it in the my example? or realy disable the updowns?) - or you need that: when user "play" with updown of one control, then the all other controls (of updown) will be changed as this control (that user is playing with)? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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