Advertisement
TLama

Untitled

Jan 13th, 2015
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.12 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Registry]
  7. Root: HKLM; Subkey: "Software\My Company\My Program\Settings"; ValueType: string; ValueName: "InstallPath"; ValueData: "{code:GetDirPath}"
  8.  
  9. [Code]
  10. var
  11.   InputPage: TInputDirWizardPage;
  12.   RadioButtons: array[0..1] of TNewRadioButton;
  13.  
  14. function GetDirPath(Param: string): string;
  15. begin
  16.   Result := InputPage.Values[0];
  17. end;
  18.  
  19. procedure ShiftDirPageItem(Page: TInputDirWizardPage; Index: Integer;
  20.   Offset: Integer);
  21. begin
  22.   Page.Edits[Index].Top := Page.Edits[Index].Top + Offset;
  23.   Page.Buttons[Index].Top := Page.Buttons[Index].Top + Offset;
  24.   Page.PromptLabels[Index].Top := Page.PromptLabels[Index].Top + Offset;
  25. end;
  26.  
  27. procedure SetDirPageItemEnabled(Page: TInputDirWizardPage; Index: Integer;
  28.   Enabled: Boolean);
  29. begin
  30.   Page.Edits[Index].Enabled := Enabled;
  31.   Page.Buttons[Index].Enabled := Enabled;
  32.   Page.PromptLabels[Index].Enabled := Enabled;
  33. end;
  34.  
  35. procedure RadioButtonClick(Sender: TObject);
  36. begin
  37.   SetDirPageItemEnabled(InputPage, 0, Sender = RadioButtons[1]);
  38. end;
  39.  
  40. procedure InitializeWizard;
  41. begin
  42.   InputPage := CreateInputDirPage(wpWelcome, 'Caption', 'Description',
  43.     'SubCaption', False, '');
  44.   InputPage.Add('Prompt');
  45.  
  46.   RadioButtons[0] := TNewRadioButton.Create(InputPage);
  47.   RadioButtons[0].Parent := InputPage.Surface;
  48.   RadioButtons[0].Left := 0;
  49.   RadioButtons[0].Top := 0;
  50.   RadioButtons[0].Width := InputPage.SurfaceWidth;
  51.   RadioButtons[0].Checked := True;
  52.   RadioButtons[0].Caption := 'Option with no file selection';
  53.   RadioButtons[0].OnClick := @RadioButtonClick;
  54.  
  55.   RadioButtons[1] := TNewRadioButton.Create(InputPage);
  56.   RadioButtons[1].Parent := InputPage.Surface;
  57.   RadioButtons[1].Left := RadioButtons[0].Left;
  58.   RadioButtons[1].Top := RadioButtons[0].Top + RadioButtons[0].Height + 2;
  59.   RadioButtons[1].Width := InputPage.SurfaceWidth;
  60.   RadioButtons[1].Checked := False;
  61.   RadioButtons[1].Caption := 'Option with file selection';
  62.   RadioButtons[1].OnClick := @RadioButtonClick;
  63.  
  64.   ShiftDirPageItem(InputPage, 0, RadioButtons[1].Top);
  65.   SetDirPageItemEnabled(InputPage, 0, False);
  66. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement