Jump to content

Combo Box: Changing default value


Go to solution Solved by c.haslam,

Recommended Posts

Posted (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 by c.haslam
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Posted

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

 

Posted

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

 

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...