1

My Inno setup installer consist only on 2 custom pages. in the first custom page show show "Abort" button and "Agree and Install" button in the second custom page I want to replace the "Abort" button with "Decline" button, just to change the caption of the button ! I dont know how to adress the page ID of the first and the second page so i cant make it happen.

I have seen how to create custom pages and add them to the wizard in the InitializeWizard procedure.

My problem is that when I create a custom page the default page for install location selection does not appear any more.

What options do I have to keep the default page(install location selection) and also add a my new custom page?

    Code:
   --------- here are my pages - -----------
         procedure CreateTheWizardPages;
       var
        Page: TWizardPage;
    Title: TNewStaticText;
    Desc: TRichEditViewer;
    CB_border: TPanel;
    HPCB: TCheckBox;
    HP_Lable:TRichEditViewer;
    DSCB: TCheckBox;
    DS_Lable:TRichEditViewer;
    Footer: TRichEditViewer;
    LinkTerms, LinkPP: TNewStaticText;
    DeclineButton: TNewButton;
    checkx: integer;
 begin

  Page := CreateCustomPage(
  wpWelcome,
  ExpandConstant('{cm:MainOfferPageCaption}'),
   ExpandConstant('{cm:MainOfferPageDescription}'));
      Page.Surface.Notebook.SetBounds(10, 70, ScaleX(WizardForm.Width), ScaleY(500));

{ Title }
    Title := TNewStaticText.Create(Page);
    Title.Parent := Page.Surface;
    Title.Left := ScaleX(0);
    Title.Top := ScaleY(0);
    Title.Width := ScaleX(200);
    Title.Height := ScaleY(30);
    Title.Color := -16777186;
    Title.Font.Name := 'Verdana';
    Title.Font.Style := [fsBold];
    Title.Caption := 'Wise Convert app';
    Title.Font.size := 12;
    Title.TabOrder := 1;


        Page := CreateCustomPage(Page.ID, 'Custom wizard page controls', 'TComboBox and others');
   { Title }
      Title := TNewStaticText.Create(Page);
      Title.Parent := Page.Surface;
      Title.Left := ScaleX(0);
      Title.Top := ScaleY(0);
      Title.Width := ScaleX(200);
      Title.Height := ScaleY(30);
      Title.Color := -16777186;
      Title.Font.Name := 'Verdana';
      Title.Font.Style := [fsBold];
      Title.Caption := 'Wise Convert app';
      Title.Font.size := 18;
      Title.TabOrder := 1;

    end;

   ------- here i change the buttons caption ----------
    procedure CreateAgreeButton(ParentForm: TSetupForm; nextButton: TNewButton);
var          
  AgreeButton: TNewButton;
begin
  WizardForm.NextButton.Caption := '&Agree and Install';

end;

procedure CreateCancelButton(ParentForm: TSetupForm; CancelButton: TNewButton);

begin

  WizardForm.CancelButton.Caption := '&Abort';
  WizardForm.backButton.Visible := false;

 end;
Deanna
  • 23,876
  • 7
  • 71
  • 156
ElramV
  • 325
  • 4
  • 16
  • 2
    Adding a custom page can move the directory selection page after the custom page, but won't cause it to disappear. Could you show us the minimum script that will reproduce this behavior ? – TLama Jul 30 '14 at 13:53
  • You are telling the `CreateCustomPage` function to put your first custom page right after the welcome page (that's the `wpWelcome` constant in your code) and thus before the directory selection page. It is not hidden (as long as you didn't specified it to be hidden in the `[Setup]` section), but it's after your custom pages. – TLama Jul 30 '14 at 14:07
  • I specifyed the wpWelcome to be hidden in the [Setup] – ElramV Jul 30 '14 at 14:26
  • Even when you hide the welcome page (with the `DisableWelcomePage=yes` directive) you are still adding your custom page after the welcome page. Inno Setup doesn't care if it's invisible. It silently skips the page and as the first page you will see your custom one. If you want to see the directory selection page as first, add your first custom page after `wpSelectDir`. – TLama Jul 30 '14 at 14:36
  • how doing the above(add your first custom page after wpSelectDir) will help me change the second costume page button caption ? – ElramV Jul 30 '14 at 14:55
  • In the code that you've shown replace in the first call of `CreateCustomPage` function value `wpWelcome` to `wpSelectDir`. That is the parameter by which you define after which page the just created custom page should be placed. – TLama Jul 30 '14 at 14:59
  • ok i did as you suggested but now what? my second custom page still has the "abort" caption how do I replace the "abort" caption with "decline"? – ElramV Jul 31 '14 at 08:23
  • Do it e.g. from the `CurPageChanged` event. Btw. I think that [`this post`](http://stackoverflow.com/q/22183811/960757) might interest you. – TLama Jul 31 '14 at 08:46
  • here is what i wrote - ' procedure CurPageChanged(CurPageID: Integer); begin CreateCancelButton(WizardForm, WizardForm.CancelButton); CreateAgreeButton(WizardForm, WizardForm.nextButton); end;' with the above code I change the "Cancel" button to "Abort" and the "Next" button to "Agree and Install" for the 2 custom pages but how i tell my installer i want the second custom page to have a "Decline" button instead of "Abort"?? – ElramV Jul 31 '14 at 12:55
  • You will need to store the page references into some global variables and in the `CurPageChanged` event method ask the `CurPageID` parameter if it matches to some of you page IDs. I would write it [`this way`](http://pastebin.com/ZNeHwu6b). Just few sidenotes, your `Create...Button` procedures are quite useless. There is no need to pass the references to unique objects as parameters. Also, their naming is not good; they don't create anything, they just change captions. – TLama Jul 31 '14 at 13:23
  • 10X A LOT TLama, IT WORKS! – ElramV Aug 06 '14 at 07:06

0 Answers0