Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inno setup bmp image appear on a single page

Tags:

inno-setup

I want a bmp image to appear on a single page "selectadditionaltasks" but it appears on all pages. What am I doing wrong?

procedure LogoOnClick(Sender: TObject);
var ResCode: Integer;
begin
end;
procedure LogoWizard();

var
  BtnPanel: TPanel;
  BtnImage: TBitmapImage;
begin
  ExtractTemporaryFile('Logo.bmp')

  BtnPanel:=TPanel.Create(WizardForm)
  with BtnPanel do begin
    Left:=40
    Top:=250
    Width:=455
    Height:=42
    Cursor:=crHand
    OnClick:=@logoOnClick
    Parent:=WizardForm
  end
  BtnImage:=TBitmapImage.Create(WizardForm)
  with BtnImage do begin
    AutoSize:=True;
    Enabled:=False;
    Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\Logo.bmp')
    Parent:=BtnPanel
  end
end;
procedure InitializeWizard();
begin
  LogoWizard();
end;

image example

Setup screenshot

like image 341
Marcio Avatar asked Oct 17 '12 16:10

Marcio


1 Answers

By setting a Parent of your BtnPanel to the WizardForm you're telling, that you want that panel to be an immediate child of the whole wizard form. You'd have to change the BtnPanel.Parent property to the page surface, on which you want that panel to appear.

Since you want your image to appear on the Select Additional Tasks wizard page, the best I can suggest is to use just the image without an underlying panel and resize the TasksList check list box, which by default covers also the bottom area of the page, where you want to place your image. And that does the following script. You may follow the commented version of this script as well:

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

[Files]
Source: "Logo.bmp"; Flags: dontcopy

[Tasks]
Name: associate; Description: "&Associate files"; Flags: unchecked
Name: desktopicon; Description: "Create a &desktop icon"; Flags: unchecked

[Code]
procedure LogoOnClick(Sender: TObject);
begin
  MsgBox('Hello!', mbInformation, MB_OK);
end;

procedure InitializeWizard;
var
  BtnImage: TBitmapImage;
begin
  ExtractTemporaryFile('Logo.bmp');

  BtnImage := TBitmapImage.Create(WizardForm);
  with BtnImage do 
  begin
    Parent := WizardForm.SelectTasksPage;
    Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\Logo.bmp');
    AutoSize := True;
    Left := 0;
    Top := WizardForm.SelectTasksPage.Top + WizardForm.SelectTasksPage.Height - 
      Height - 8;
    Cursor := crHand;
    OnClick := @LogoOnClick;            
  end;
  WizardForm.TasksList.Height :=
    WizardForm.TasksList.Height - BtnImage.Height - 8;
end;
like image 144
TLama Avatar answered Sep 29 '22 05:09

TLama