soyfelix Posted March 13, 2008 Share Posted March 13, 2008 Hello, Excume for my english, but ill try. sI need to refresh to default values the following controls:GUICtrlCreateComboGUICtrlCreateInputGUICtrlCreateDateI have made severals GUI with 80 o 90 of this controls, I have wrotten in them values like this:$Combo1 = GUICtrlCreateCombo("", 120, 80, 249, 25)GUICtrlSetData(-1, "Si|No", "No")$Input1 = GUICtrlCreateInput("", 120, 120, 249, 21)$Date1 = GUICtrlCreateDate("9999/12/31 12:27:25", 120, 160, 257, 33)When the user fill this controls i hide the gui, and then when the user show the same gui, the controls have the old values. I know this way to set values into the controls:GUICtrlSetData(Combo1 , "Si|No", "No")GUICtrlSetData(Input1 , "")GUICtrlSetData(Date1 , "9999/12/31")but i have a loooootttt ooooffff controls like this and its very hard to code for me.Is there any way to set the default value for this controls?? is that the only way???Thanksss!!!! Link to comment Share on other sites More sharing options...
Zedna Posted March 13, 2008 Share Posted March 13, 2008 Make array of controls (stor control's ID to array) and use FOR NEXT loop to set data to them. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
weaponx Posted March 13, 2008 Share Posted March 13, 2008 See an example here:#482000 Link to comment Share on other sites More sharing options...
soyfelix Posted March 13, 2008 Author Share Posted March 13, 2008 Make array of controls (stor control's ID to array) and use FOR NEXT loop to set data to them.See an example here:http://www.autoitscript.com/forum/index.ph...st&p=482000Thanks for the reply, but what´s "stor Control`s ID"?? How can i make it??Thankkssss Link to comment Share on other sites More sharing options...
rasim Posted March 13, 2008 Share Posted March 13, 2008 One of the variants: #include <GuiConstants.au3> Global $Default = "No" $hGui = GUICreate("Test GUI", 300, 200) $hStartDummy = GUICtrlCreateDummy() GUICtrlCreateInput("", 10, 10, 200, 20) GUICtrlCreateCombo("", 10, 40, 200, 20) GUICtrlCreateInput("", 10, 70, 200, 20) GUICtrlCreateCombo("", 10, 100, 200, 20) $hEndDummy = GUICtrlCreateDummy() $RefreshButton = GUICtrlCreateButton("Refresh", 10, 170, 60, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case - 3 ExitLoop Case $RefreshButton For $i = $hStartDummy To $hEndDummy GUICtrlSetData($i, "") GUICtrlSetData($i, $Default, $Default) Next EndSwitch WEnd Link to comment Share on other sites More sharing options...
soyfelix Posted March 13, 2008 Author Share Posted March 13, 2008 One of the variants: #include <GuiConstants.au3> Global $Default = "No" $hGui = GUICreate("Test GUI", 300, 200) $hStartDummy = GUICtrlCreateDummy() GUICtrlCreateInput("", 10, 10, 200, 20) GUICtrlCreateCombo("", 10, 40, 200, 20) GUICtrlCreateInput("", 10, 70, 200, 20) GUICtrlCreateCombo("", 10, 100, 200, 20) $hEndDummy = GUICtrlCreateDummy() $RefreshButton = GUICtrlCreateButton("Refresh", 10, 170, 60, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case - 3 ExitLoop Case $RefreshButton For $i = $hStartDummy To $hEndDummy GUICtrlSetData($i, "") GUICtrlSetData($i, $Default, $Default) Next EndSwitch WEnd Thak you very much, but what can i differentiate between combo, input or date into the loop "for", because $i is a number??? Thanks!!!!! Link to comment Share on other sites More sharing options...
Squirrely1 Posted March 14, 2008 Share Posted March 14, 2008 (edited) rasim teaches us the use of GUICtrlCreateDummy in his script but this isn't the usual way of referencing controls in your GUI. Instead, the functions "GUICtrlCreateCombo" and "GUICtrlCreateInput", etc., return control ID's that you can use. Edited March 14, 2008 by Squirrely1 Das Häschen benutzt Radar 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