Search code examples
inno-setupskin

Why are these check boxes not showing with the correct text colour in Inno Setup with skins?


I am using a skin with my Inno Setup:

#define Skin "Amakrits.vsf"

I use the VCL Styles DLL for the skinning:

Source: {#InnoPath}\VclStylesinno.dll; DestDir: "{app}";

I have a custom page for application settings:

function AppSettings_CreatePage(PreviousPageId: Integer): Integer;
var
    Page: TWizardPage;
    iUserValue: Cardinal;
    strPath: String;
begin
    Page := CreateCustomPage(
        PreviousPageId,
        ExpandConstant('{cm:ApplicationPreferences}'),
        ExpandConstant('{cm:DefaultSettings}')
    );

    // lblInfo
    lblInfo := TLabel.Create(Page);
    with lblInfo do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('{cm:SpecifyDefaultSettings}');
        Left := ScaleX(8);
        Top := ScaleY(8);
        Width := ScaleX(387);
        Height := ScaleY(29);
    end;

    // chkRememberLastCong
    chkRememberLastCong := TCheckBox.Create(Page);
    with chkRememberLastCong do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('{cm:UserRememberCongregation}');
        Left := ScaleX(8);
        Top := ScaleY(32);
        Width := ScaleX(385);
        Height := ScaleY(25);
        TabOrder := 0;

        // Set default value (for when registry value does not exist)
        iUserValue := 1;
        // Get registry value
        RegQueryDWordValue(HKLM,
                     'Software\Community Talks\Public Talks\Preferences',
                     'ReuseCong', iUserValue);
        // Update option on page.
        Checked := iUserValue = 1;
    end;

    // chkDuplicates
    chkDuplicates := TCheckBox.Create(Page);
    with chkDuplicates do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('{cm:UserCheckDuplicates}');
        Left := ScaleX(8);
        Top := ScaleY(56);
        Width := ScaleX(393);
        Height := ScaleY(17);
        TabOrder := 1;

        // Set default value (for when registry value does not exist)
        iUserValue := 0;    // Default
        // Get registry value
        RegQueryDWordValue(HKLM,
                     'Software\Community Talks\Public Talks\Preferences',
                     'Duplicate', iUserValue);
        // Update option on page.
        Checked := iUserValue = 1;
    end;

    // lblDatabase
    lblDatabase := TLabel.Create(Page);
    with lblDatabase do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('{cm:DatabaseLanguage}');
        Left := ScaleX(8);
        Top := ScaleY(112);
        Width := ScaleX(385);
        Height := ScaleY(13);
    end;

    // cbDatabase
    cbDatabase := TNewComboBox.Create(Page);
    with cbDatabase do
    begin
    #define DatabaseFile(Name, Text) \
        'Items.Add(''' + Text + ''');' + NewLine + \
        'if ActiveLanguage = ''' + Name + ''' then ItemIndex := Items.Count - 1;' + NewLine

        Parent := Page.Surface;
        Left := ScaleX(8);
        Top := ScaleY(128);
        Width := ScaleX(177);
        Height := ScaleY(21);
        Style := csDropDownList;
        TabOrder := 3;

        // Languages
        {#DatabaseFiles}
   
        // Get path where the program was last install
        strPath := GetPathInstalled('Public Talks');
  end;

  Result := Page.ID;
end;

What I don't understand is why the check boxes do not render with the correct text colour? See:

enter image description here


Do standard checkboxes/radio buttons have an expected color?

Here are two standard windows in the installer which have checkboxes/radio controls by default, and they have white text as expected.

  • Checkboxes

enter image description here

  • Radios

enter image description here


Solution

  • What I don't understand is why the check boxes do not render with the correct text colour?

    It is because you are using 'standard' Delphi components like TCheckBox, TLabel, etc.

    Use Inno Setup 'New' components that supports custom drawing:

    TCheckBox -> TNewCheckBox

    TLabel -> TNewStaticText

    Code:

    chkRememberLastCong: TNewCheckBox;
    chkDuplicates: TNewCheckBox;
    lblDatabase: TNewStaticText;
    cbDatabase: TNewComboBox;