0

Components Selection Page

Custom DirPage where the items are diasbled/enabled based on Components Selection

I need the code to perform the above operations.

+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

Below is my sample code that i written.here the problem is it wil only work when we deselect the component => click Next(the dir items are still enabled) =>Click back=> click again Next(now it works i.e. the dir items disabled)

i.e. it does not refreshes in first attempt

Sorry for bad english

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Types] 
Name: full; Description: Full Installation
Name: custom; Description: Custom Installation; Flags: iscustom

[Components]
Name: "crfl"; Description: "Core Files"; Types: full custom; Flags: fixed
Name: "vst"; Description: "VST"; Types: full
Name: "vst64"; Description: "VST64"; Types: full

[Code]
var
  CPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
  CPage := CreateInputDirPage(wpSelectComponents,
    'Select Personal Data Location', 'Where should personal data files be stored?',
    'Personal data files will be stored in the following folder.'#13#10#13#10 +
    'To continue, click Next. ' +
      'If you would like to select a different folder, click Browse.',
    False, 'New Folder');

  CPage.Add('VST');
  CPage.Add('VST64');

  CPage.Values[0] := ExpandConstant('{pf}\VST');
  CPage.Values[1] := ExpandConstant('{pf}\VST64');
end;

procedure CurPageChanged(PageID: Integer);
begin
  if PageID = wpSelectComponents then begin
    CPage.PromptLabels[0].Enabled := False;
    CPage.Edits[0].Enabled := False;
    CPage.Buttons[0].Enabled := False;

    CPage.PromptLabels[1].Enabled := False;
    CPage.Edits[1].Enabled := False;
    CPage.Buttons[1].Enabled := False;

    if IsComponentSelected('vst') then begin
      CPage.PromptLabels[0].Enabled := True;
      CPage.Edits[0].Enabled := True;
      CPage.Buttons[0].Enabled := True;
    end;

    if IsComponentSelected('vst64') then begin
      CPage.PromptLabels[1].Enabled := True;
      CPage.Edits[1].Enabled := True;
      CPage.Buttons[1].Enabled := True;
    end;
  end;
end;

1 Answers1

0

It should be:

  if PageID = CPage.ID then

Further the code can be simplified to:

procedure CurPageChanged(PageID: Integer);
begin
  if PageID = CPage.ID then
  begin
    CPage.PromptLabels[0].Enabled := IsComponentSelected('vst');
    CPage.Edits[0].Enabled := CPage.PromptLabels[0].Enabled;
    CPage.Buttons[0].Enabled := CPage.PromptLabels[0].Enabled;

    CPage.PromptLabels[1].Enabled := IsComponentSelected('vst64');
    CPage.Edits[1].Enabled := CPage.PromptLabels[1].Enabled;
    CPage.Buttons[1].Enabled := CPage.PromptLabels[1].Enabled;
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992