Leopardfist Posted July 26, 2005 Share Posted July 26, 2005 Example... The options dont matter for the example... it is just to give you an idea of what I want the ctrl to do.$GUIMain=GUIcreate("Test Combo", 200, 200, 200, 200)$Combo=GUIctrlCreateCombo("", 50, 50, 50, 50)GUIctrlsetdata($Combo, "1|2|3|4|5")There's the control... now for the task I want it to performFor Instance the User Selects the setting 3!Then they save settings via the following tool:Iniwrite("Combo.Ini", "Setting", "Combobox", $Combo)What I am trying to do is to use the following to set the state of the ctrl.INIRead("Combo.Ini", "Setting", "Combobox", "")Then to SET the combo ctrl to the value we saved it to previously!Any advice is greatly appreciated! Link to comment Share on other sites More sharing options...
buzz44 Posted July 26, 2005 Share Posted July 26, 2005 GUICtrlSetData() qq Link to comment Share on other sites More sharing options...
Leopardfist Posted July 26, 2005 Author Share Posted July 26, 2005 GUICtrlSetData()<{POST_SNAPBACK}>Well, my program is not just one ctrl or even combo... and if I do guictrlsetdata($Combo, $Combo) it will take the 1|2|3|4|5 setting it has and change it to only that one value.... I want the control itself to always be a dropdown menu of 1-5... I just want to be able to save the value so when the program is ran again, it will load the last value saved, and set the combo's state to showing that value.I will code a more correct script for an example... and post it here when I am done! Link to comment Share on other sites More sharing options...
Leopardfist Posted July 26, 2005 Author Share Posted July 26, 2005 (edited) Opt("GUICloseonESC",0) Opt("guioneventmode",1) #Include<GUIConstants.au3> ;First I want to check to see if an INI file has already been written... If fileexists("Example.ini") then $Combovalue=INIRead("Example.ini", "Section", "Key", "") EndIf ;Then I want to create my GUI and display it... the basic commands have it create just a basic combo that when selected will have 5 different values to choose from. $GUI=GUIcreate("Combo Test", 300, 300, 100, 100) $Combo=guictrlcreatecombo("", 40, 40, 50, 50) GUIctrlsetdata($Combo, "1|2|3|4|5", "") GUIctrlsetonevent(-1, "SetValue") $Save=GUIctrlcreatebutton("Save", 100, 250, 100, 40) GUIctrlsetonevent(-1, "Save") GUISetstate() While 1 Sleep(500) WEnd Func SetValue() $Combovalue=GUIctrlRead($Combo) EndFunc Func Save() INIWrite("Example.ini", "Section", "Key", $Combovalue) EndFuncI want the program to read the saved value, and set the combo control to display that value, without losing the other 4 values OR HAVING THE VALUE SELECTED IN THE LIST TWICE!I say that last part because I have been able to do that.. I got the control to display the value, but when you clicked on it you coudl see it in the list again, duplicated. Edited July 26, 2005 by Leopardfist Link to comment Share on other sites More sharing options...
GaryFrost Posted July 26, 2005 Share Posted July 26, 2005 The UDFs (User Defined Functions) in the beta will do what you want. _GUICtrlComboFindString returns the index of string looking for in combo box _GUICtrlComboSetCurSel sets the selection based on an index supplied. Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Leopardfist Posted July 26, 2005 Author Share Posted July 26, 2005 The UDFs (User Defined Functions) in the beta will do what you want._GUICtrlComboFindString returns the index of string looking for in combo box_GUICtrlComboSetCurSel sets the selection based on an index supplied.Gary<{POST_SNAPBACK}>Thank You! I will install the beta version now! 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