1
votes

I am trying to use the [ISPP] section to define a hexadecimal color which will later be used in the [Code] section as a spot color, the value of which may change in the future, but I am getting a type mismatch error when running. Here are the relevant sections from the code:

[ISPP]
#define ColorPetrol "$C8C264"

[Code]
procedure InitializeWizard();
var
  PortLabel: TNewStaticText;
begin
  PortLabel := TNewStaticText.Create(WizardForm);
  PortLabel.Caption := 'Port';
  PortLabel.Top := ScaleY(78);
  PortLabel.Parent := Page.Surface;
  PortLabel.Font.Color := ExpandConstant('{#ColorPetrol}');
end;

I am assuming the error is caused by the define constant being a string and the PortLabel.Font.Color requiring a hex value. How can the constant be defined in the [ISPP] section and used in this way correctly?

1

1 Answers

2
votes

Just use PortLabel.Font.Color := {#ColorPetrol};. ExpandConstant() is for expanding built-in Inno Setup constants, not for ISPP defines. The latter really are just about textual replacements.

As a side note, I'm not aware of an [ISPP] section. IMO you should just move the define to the [Code] section.