Advertisement
TLama

Untitled

Aug 6th, 2013
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 4.54 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Languages]
  7. Name: english; MessagesFile: compiler:Default.isl
  8.  
  9. [Files]
  10. Source: file1.exe; DestDir: {app};
  11. Source: file2.exe; DestDir: {app};
  12. Source: file3.exe; DestDir: {app};
  13.  
  14. [Run]
  15. Filename: {app}\file1.exe; Flags: hidewizard runhidden 32bit; WorkingDir: {localappdata}; Check: ShouldRunItem(1)
  16. Filename: {app}\file2.exe; Flags: hidewizard runhidden 32bit; WorkingDir: {localappdata}; Check: ShouldRunItem(2)
  17. Filename: {app}\file3.exe; Flags: hidewizard runhidden 64bit; WorkingDir: {localappdata}; Check: ShouldRunItem(3)
  18.  
  19. [Code]
  20. const
  21.   FileOneDesc =
  22.     'Select if you want to run File1.exe';
  23.   FileTwoDesc =
  24.     'Select if you want to run File2.exe';
  25.   FileThreeDesc =
  26.     'Select if you want to run File3.exe';
  27.  
  28. var
  29.   CustomPage: TWizardPage;
  30.   FileOneButton: TNewRadioButton;
  31.   FileTwoButton: TNewRadioButton;
  32.   FileThreeButton: TNewRadioButton;
  33.  
  34. function ShouldRunItem(Value: Integer): Boolean;
  35. begin
  36.   Result := False;
  37.   case Value of
  38.     1: Result := FileOneButton.Checked;
  39.     2: Result := FileTwoButton.Checked;
  40.     3: Result := FileThreeButton.Checked;
  41.   end;
  42. end;
  43.  
  44. procedure RadioButtonClick(Sender: TObject);
  45. begin
  46.   // from this radio button OnClick event handler just enable the Next button
  47.   WizardForm.NextButton.Enabled := True;
  48. end;
  49.  
  50. procedure InitializeWizard;
  51. var                                                  
  52.   FileOneDesclabel: TLabel;
  53.   FileTwoDesclabel: TLabel;
  54.   FileThreeDesclabel: TLabel;
  55. begin
  56.   CustomPage := CreateCustomPage(wpWelcome, 'Multiple executable pre-launch wizard', '');
  57.   FileOneButton := TNewRadioButton.Create(WizardForm);
  58.   FileOneButton.Parent := CustomPage.Surface;
  59.   FileOneButton.Top := 16;    
  60.   FileOneButton.Width := CustomPage.SurfaceWidth;
  61.   FileOneButton.Font.Style := [fsBold];
  62.   FileOneButton.Font.Size := 9;
  63.   FileOneButton.Caption := 'Run File #1';
  64.   // assign the OnClick event handler for enabling Next button
  65.   FileOneButton.OnClick := @RadioButtonClick;
  66.   FileOneDescLabel := TLabel.Create(WizardForm);
  67.   FileOneDescLabel.Parent := CustomPage.Surface;
  68.   FileOneDescLabel.Left := 8;
  69.   FileOneDescLabel.Top := FileOneButton.Top + FileOneButton.Height + 8;
  70.   FileOneDescLabel.Width := CustomPage.SurfaceWidth;
  71.   FileOneDescLabel.Height := 40;
  72.   FileOneDescLabel.AutoSize := False;
  73.   FileOneDescLabel.Wordwrap := True;
  74.   FileOneDescLabel.Caption := FileOneDesc;
  75.  
  76.   FileTwoButton := TNewRadioButton.Create(WizardForm);
  77.   FileTwoButton.Parent := CustomPage.Surface;
  78.   FileTwoButton.Top := FileOneDesclabel.Top + FileOneDesclabel.Height + 8;
  79.   FileTwoButton.Width := CustomPage.SurfaceWidth;
  80.   FileTwoButton.Font.Style := [fsBold];
  81.   FileTwoButton.Font.Size := 9;
  82.   FileTwoButton.Caption := 'Run File #2';
  83.   // assign the OnClick event handler for enabling Next button
  84.   FileTwoButton.OnClick := @RadioButtonClick;
  85.   FileTwoDescLabel := TLabel.Create(WizardForm);
  86.   FileTwoDescLabel.Parent := CustomPage.Surface;
  87.   FileTwoDescLabel.Left := 8;
  88.   FileTwoDescLabel.Top := FileTwoButton.Top + FileTwoButton.Height + 8;
  89.   FileTwoDescLabel.Width := CustomPage.SurfaceWidth;
  90.   FileTwoDescLabel.Height := 40;
  91.   FileTwoDescLabel.AutoSize := False;
  92.   FileTwoDescLabel.Wordwrap := True;
  93.   FileTwoDescLabel.Caption := FileTwoDesc;  
  94.  
  95.   FileThreeButton := TNewRadioButton.Create(WizardForm);
  96.   FileThreeButton.Parent := CustomPage.Surface;
  97.   FileThreeButton.Top := FileTwoDesclabel.Top + FileTwoDesclabel.Height + 10;
  98.   FileThreeButton.Width := CustomPage.SurfaceWidth;
  99.   FileThreeButton.Font.Style := [fsBold];
  100.   FileThreeButton.Font.Size := 9;
  101.   FileThreeButton.Caption := 'Run File #3';
  102.   // assign the OnClick event handler for enabling Next button
  103.   FileThreeButton.OnClick := @RadioButtonClick;
  104.   FileThreeDescLabel := TLabel.Create(WizardForm);
  105.   FileThreeDescLabel.Parent := CustomPage.Surface;
  106.   FileThreeDescLabel.Left := 8;
  107.   FileThreeDescLabel.Top := FileThreeButton.Top + FileThreeButton.Height + 8;
  108.   FileThreeDescLabel.Width := CustomPage.SurfaceWidth;
  109.   FileThreeDescLabel.Height := 40;
  110.   FileThreeDescLabel.AutoSize := False;
  111.   FileThreeDescLabel.Wordwrap := True;
  112.   FileThreeDescLabel.Caption := FileThreeDesc;  
  113. end;
  114.  
  115. procedure CurPageChanged(CurPageID: Integer);
  116. begin
  117.   // if you've entered your custom page and none of the radio buttons is selected, then...
  118.   if (CurPageID = CustomPage.ID) and (not FileOneButton.Checked and
  119.     not FileTwoButton.Checked and not FileThreeButton.Checked)
  120.   then
  121.     // disable the Next button
  122.     WizardForm.NextButton.Enabled := False;
  123. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement