cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pbsdis
Level 6

Dropdown list questions on InstallScript MSI

Hi,

I am modifying an existing dropdown list control on a dialog, here are what I want to do:

1) Currently the dropdown list contains 3 string items (loaded from a string list), and one of them has been set as default (and visible). Now I want to make none of them as default, but instead put some texts like 'Select Me'.

2) I also want to force a valid selection, i.e. until users have selected one from the 3 items, the 'Next' button of the dialog would remain disabled.


How can I do them?

Here is the existing code about the control in the custom dialog:

case DLG_INIT:
// Get the handle to the dialog.
hDialog = CmdGetHwndDlg(szDialog);


// Create dropdown list.
listSomeCode = ListCreate(STRINGLIST);
ListAddString (listSomeCode,"TEST1",AFTER);
ListAddString (listSomeCode,"TEST2",AFTER);
ListAddString (listSomeCode,"TEST3",AFTER);

// Associate the dropdown list with the combo box.
CtrlSetList(szDialog,CTRL_ID_COMBO,listSomeCode);
if (szSomeCode = "") then
szDefault = "TEST1";
szSomeCode = szDefault;
else
szDefault = szSomeCode;
endif;
CtrlSetCurSel(szDialog,CTRL_ID_COMBO,szDefault);

....

Thanks,
PB
Labels (1)
0 Kudos
(2) Replies
pbsdis
Level 6

I alternatively add 'Select Me' to the list and make it as default, so if there is no better way for it, this may work for question 1).

I can also force users to select a valid item from the list in order to enable 'Next' button. If not a valid one selected, I disable 'Next' button and make users to select again.

But the problem is that if I don't touch the dropdown list control in the dialog, the 'Next' will be enabled and users can go to next dialog.

How can I force users to do selection of the dropdown list before 'Next' is enabled?


Thanks,
PB
0 Kudos
RobertDickau
Flexera Alumni

You can use EnableWindow to enable and disable a control such as a button. (See the source for SdRegisterUser and others.) Perhaps set the default state of the Next button to disabled, and then enable it based on the list-box selection?
0 Kudos