c.haslam Posted August 15, 2024 Posted August 15, 2024 (edited) Early in my script I have: $cmbEDOW = GUICtrlCreateCombo("", 120, 71, 81, 25, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday","Sunday") Later in my script the user can change the day of the week to a different one, e.g. s being "Friday", so I have: Local $t = "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday" GUICtrlSetData($cmbEDOW,$t,s) But when the user clicks on the control he sees 15 choices, Sunday .. Saturday is repeated and a third Sunday is added at the end. I have tried setting data to "". It doesn't help. Edited August 15, 2024 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
c.haslam Posted August 15, 2024 Author Posted August 15, 2024 I could not edit, so here is corrected version: Early in my script I have: $cmbEDOW = GUICtrlCreateCombo("", 120, 71, 81, 25, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday","Sunday") Later in my script the script changes the day of the week to a different one, e.g. s being "Friday", so I have: Local $t = "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday" GUICtrlSetData($cmbEDOW,$t,s) But when the user clicks on the control he sees 15 choices, Sunday .. Saturday is repeated and a third Sunday is added at the end. I have tried setting data to "". It doesn't help. Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
ahmet Posted August 15, 2024 Posted August 15, 2024 Under remarks for GUICtrlSetData() there is this line: "If the "data" starts with GUIDataSeparatorChar or is an empty string "" the previous list is destroyed. A trailing GUIDataSeparatorChar is ignored." So your "later" line should be Local $t = "|Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday"
c.haslam Posted August 15, 2024 Author Posted August 15, 2024 Thank you. I now understand "If the "data" starts with GUIDataSeparatorChar ... the previous list is destroyed". "If the "data" starts with GUIDataSeparatorChar ... the previous list is destroyed and the list that followings the GuiDataSeparatorChar replaces the old list" would be clearer. I don't see how "data" being "an empty string" would be useful. Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
Andreik Posted August 15, 2024 Posted August 15, 2024 38 minutes ago, c.haslam said: I don't see how "data" being "an empty string" would be useful. It's useful to clear the combo in order to add new data without being appended to the current data or simply for the cases where you want to clear all data.
Solution c.haslam Posted August 16, 2024 Author Solution Posted August 16, 2024 Understood Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
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