I already have a combobox
in a TInputQueryWizardPage
page but the problem is I don’t know how to retrieve the selected value from the registry after writing from the first run.
My code for combobox is:
AuthComboBox := TNewComboBox.Create(ReportPage);
AuthComboBox.Parent := ReportPage.Edits[1].Parent;
AuthComboBox.Left := ReportPage.Edits[1].Left;
AuthComboBox.Top := ReportPage.Edits[1].Top;
AuthComboBox.Width := ReportPage.Edits[1].Width;
AuthComboBox.Height := ReportPage.Edits[1].Height;
AuthComboBox.TabOrder := ReportPage.Edits[1].TabOrder;
AuthComboBox.Items.Add('Password Authentication');
AuthComboBox.Items.Add('Windows Authentication');
AuthComboBox.ItemIndex := 0;
{ Hide the original edit box }
ReportPage.PromptLabels[1].FocusControl := AuthComboBox;
ReportPage.Edits[1].Visible := False;
AuthComboBox.OnChange := @ComboBoxChange;
Values behind AuthComboBox.Items.Add
are:
function GetAuthCombo(Param: String): String;
begin
case AuthComboBox.ItemIndex of
0: Result := 'False';
1: Result := 'True';
end;
end;
I write them to the registry with the following code:
if (CurStep=ssPostInstall) then
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\RiskValue',
'ReportProdAuthType', ExpandConstant('{code:GetAuthCombo}'));
end;
If I choose the second choice Windows Authentication from combobox
I expect to have the same value (Windows Authentication) as default value now when I run the installer for the second time.