5

I want to add custom designed buttons to my Inno Script with the TBitmapImage class.

My Inno Setup script is compiling just fine but the bitmap isn't showing in the form. I looked into any possibilities but can't seem to find the error I made. That's how the TBitmapImage part looks like atm:

procedure CreateMuteButton(ParentForm: TSetupForm);
var
  MuteImage: TBitmapImage;
  BitmapFileName: String;
begin
  BitmapFileName := ExpandConstant('{tmp}\muteBtn.bmp');
  ExtractTemporaryFile(ExtractFileName(BitmapFileName));
  MuteImage := TBitmapImage.Create(ParentForm);
  MuteImage.Bitmap.LoadFromFile(BitmapFileName);
  MuteImage.Cursor := crHand;
  MuteImage.OnClick := @MuteButtonOnClick;
  MuteImage.Parent := ParentForm;
  MuteImage.Left := 45;
  MuteImage.Top := 80
  MuteImage.Width := 38;
  MuteImage.Height := 50;
end;

procedure InitializeWizard();
var
  val: Integer;
begin
  CreateMuteButton(WizardForm);
  (...)
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
timonsku
  • 1,249
  • 2
  • 21
  • 45
  • can't see anything wrong with the code, try MuteImage.BringToFront(); may be z order is getting stuffed up. – Tony Hopkinson May 27 '12 at 21:39
  • I added that, didn't helped :/ Do I need to specify something in the ()? I can't find this in the documentation. – timonsku May 27 '12 at 22:22
  • No arguments on BringToFront. Haven't done Innosetup for years, but iof I had this issue in a Delphi app, Forggetting to set parent, bringtofont, or simply the wrong parent would be waht I would look for. – Tony Hopkinson May 28 '12 at 10:05

1 Answers1

6

The WizardForm client area itself is only visible below the bottom bevelled line. Above that is WizardForm.InnerPage, and the individual/current Wizard pages in the middle contained in a private InnerNotebook.

This puts the image to the left of the pages:

MuteImage := TBitmapImage.Create(WizardForm.InnerPage);
MuteImage.Parent := WizardForm.InnerPage;
MuteImage.Left := 0;
{ Uses the top of the wizard pages to line up }
MuteImage.Top := WizardForm.SelectDirPage.Parent.Top; 

Whereas this puts it in the bottom section:

MuteImage := TBitmapImage.Create(WizardForm);
MuteImage.Parent := WizardForm;
MuteImage.Left := 0;
{ Below the inner page }
MuteImage.Top := WizardForm.InnerPage.Height; 
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Deanna
  • 23,876
  • 7
  • 71
  • 156