Цвета элементов управления на странице пользовательского мастера неверны в Windows 7 — Parallels (Inno Script)

#windows-7 #inno-setup #parallels

#windows-7 #inno-настройка #parallels

Вопрос:

Контекст:

  • MacBook Pro (последняя версия Big Sur 11.1)
  • Parallels (последняя версия)
  • Windows 7 (все обновления)

Когда я запускаю свою программу установки, моя пользовательская страница выглядит следующим образом:

введите описание изображения здесь

Некоторый текст отображается черным. Эта проблема не возникает при запуске моего установщика в родной Windows 10 на ПК.

Моя пользовательская страница спроектирована следующим образом:

 // ================================================
// Automatic Backup Settings Page
// ================================================

[Code]

{ Constants }
const
  BackupWhat_None = 0;
  BackupWhat_Complete = 1;
  BackupWhat_Essential = 2;

    BackupMode_Automatic = 0;
  BackupMode_Manual = 1;

    BackupPrompt_Never = 0;
    BackupPrompt_Daily = 1;
    BackupPrompt_Weekly = 2;
    BackupPrompt_Monthly = 3;

{ Global Variables }
var
  pageAutoBackup: TWizardPage;
  pnlBackupWhat: TPanel;
  lblBackupWhat: TLabel;
  radBackupWhatNone: TNewRadioButton;
  radBackupWhatComplete: TNewRadioButton;
  radBackupWhatEssential: TNewRadioButton;
  lblBackupMode: TLabel;
  pnlBackupMode: TPanel;
  radBackupModeAuto: TNewRadioButton;
  radBackupModeManual: TNewRadioButton;
  lblPromptMode: TLabel;
  cmbPromptMode: TNewComboBox;
  lblBackupFolder: TLabel;
  txtBackupFolder: TNewEdit;
  btnSelectBackupFolder: TNewButton;

{ Sets the state of the controls }
procedure EnableAutoBackupSettingPageControls();
var
  bEnable: Boolean;
begin
    bEnable := radBackupWhatComplete.Checked or radBackupWhatEssential.Checked

  pnlBackupMode.Enabled := bEnable;
  lblBackupMode.Enabled := bEnable;
  radBackupModeAuto.Enabled := bEnable;
  radBackupModeManual.Enabled := bEnable;
  lblPromptMode.Enabled := bEnable;
  cmbPromptMode.Enabled := bEnable;
  lblBackupFolder.Enabled := bEnable;
  txtBackupFolder.Enabled := bEnable;
  btnSelectBackupFolder.Enabled := bEnable;

  if(radBackupWhatNone.Checked = True) then
    Wizardform.NextButton.Enabled := True
  else
    Wizardform.NextButton.Enabled := DirExists(txtBackupFolder.Text);
  WizardForm.Update;
end;

{ Ask user to select the backup Folder location }
procedure btnSelectBackupFolder_Click(Sender: TObject);
var
  strFolder: string;
begin
  strFolder := txtBackupFolder.Text;

  { Display Browse Window }
  if(BrowseForFolder('', strFolder, True)) then
  begin
    txtBackupFolder.Text := strFolder;

    Wizardform.NextButton.Enabled := DirExists(txtBackupFolder.Text);
    WizardForm.Update;
  end;
end;

{ Action handler }
procedure radBackupWhat_Click(Sender: TObject);
begin
    { Set control states }
    EnableAutoBackupSettingPageControls();

end;

{ Automatic Backup Settings Custom Page }
function pageAutoBackup_CreatePage(PreviousPageId: Integer): Integer;
var
  iButtonGap: Integer;
begin
  { Create the page }
  pageAutoBackup := CreateCustomPage(PreviousPageId,
                          ExpandConstant('{cm:pageAutoBackupTitle}'),
                          ExpandConstant('{cm:pageAutoBackupDescription}'));

  { pnlBackupWhat (TPanel) }
  pnlBackupWhat := TPanel.Create(pageAutoBackup);
  pnlBackupWhat.Caption := '';
  pnlBackupWhat.BevelOuter := bvNone;
  pnlBackupWhat.BevelInner := bvNone; { default }
  pnlBackupWhat.BevelKind := bkNone;
  pnlBackupWhat.Parent := pageAutoBackup.Surface;
  pnlBackupWhat.Enabled := True;
  pnlBackupWhat.Visible := True;
  pnlBackupWhat.Left := ScaleX(0);
  pnlBackupWhat.Top := ScaleY(0);
  pnlBackupWhat.Width := pageAutoBackup.Surface.Width;
  pnlBackupWhat.Anchors := [akLeft, akRight];

  { lblBackupWhat (TLabel) }
  lblBackupWhat := TLabel.Create(pageAutoBackup);
  lblBackupWhat.Parent := pnlBackupWhat;
  lblBackupWhat.Enabled := True;
  lblBackupWhat.Visible := True;
  lblBackupWhat.Width := pnlBackupWhat.Width;
  lblBackupWhat.Caption := ExpandConstant('{cm:lblBackupWhat}');

  { radBackupWhatNone (TNewRadioButton) }
  radBackupWhatNone := TNewRadioButton.Create(pageAutoBackup);
  radBackupWhatNone.Parent := pnlBackupWhat;
  radBackupWhatNone.Enabled := True;
  radBackupWhatNone.Visible := True;
  radBackupWhatNone.Top := lblBackupWhat.Top   lblBackupWhat.Height   ScaleY(2);
  radBackupWhatNone.Width := pnlBackupWhat.Width;
  radBackupWhatNone.Height := ScaleY(radBackupWhatNone.Height);
  radBackupWhatNone.Checked := False;
  radBackupWhatNone.Caption := ExpandConstant('{cm:radBackupWhatNone}');
  radBackupWhatNone.OnClick := @radBackupWhat_Click;

  { radBackupWhatComplete (TNewRadioButton) }
  radBackupWhatComplete := TNewRadioButton.Create(pageAutoBackup);
  radBackupWhatComplete.Parent := pnlBackupWhat;
  radBackupWhatComplete.Enabled := True;
  radBackupWhatComplete.Visible := True;
  radBackupWhatComplete.Top := radBackupWhatNone.Top   radBackupWhatNone.Height   ScaleY(2);
  radBackupWhatComplete.Width := pnlBackupWhat.Width;
  radBackupWhatComplete.Height := ScaleY(radBackupWhatComplete.Height);
  radBackupWhatComplete.Checked := False;
  radBackupWhatComplete.Caption := ExpandConstant('{cm:radBackupWhatComplete}');
  radBackupWhatComplete.OnClick := @radBackupWhat_Click;

  { radBackupWhatEssential (TNewRadioButton) }
  radBackupWhatEssential := TNewRadioButton.Create(pageAutoBackup);
  radBackupWhatEssential.Parent := pnlBackupWhat;
  radBackupWhatEssential.Enabled := True;
  radBackupWhatEssential.Visible := True;
  radBackupWhatEssential.Top :=  radBackupWhatComplete.Top   radBackupWhatComplete.Height   ScaleY(2);
  radBackupWhatEssential.Width := pnlBackupWhat.Width;
  radBackupWhatEssential.Height := ScaleY(radBackupWhatEssential.Height);
  radBackupWhatEssential.Checked := False;
  radBackupWhatEssential.Caption := ExpandConstant('{cm:radBackupWhatEssential}');
  radBackupWhatEssential.OnClick := @radBackupWhat_Click;

  { Now we can set the panel height! }
  pnlBackupWhat.ClientHeight :=  
          radBackupWhatEssential.Top   radBackupWhatEssential.Height   ScaleY(5);

  { pnlBackupMode (TPanel) }
  pnlBackupMode := TPanel.Create(pageAutoBackup);
  pnlBackupMode.Caption := '';
  pnlBackupMode.BevelOuter := bvNone;
  pnlBackupMode.BevelInner := bvNone; { default }
  pnlBackupMode.BevelKind := bkNone;
  pnlBackupMode.Parent := pageAutoBackup.Surface;
  pnlBackupMode.Enabled := True;
  pnlBackupMode.Visible := True;
  pnlBackupMode.Top := pnlBackupWhat.Top   pnlBackupWhat.Height   ScaleY(2);
  pnlBackupMode.Width := pageAutoBackup.Surface.Width;
  pnlBackupMode.Height := ScaleY(100);
  pnlBackupMode.Anchors := [akLeft, akRight];

  { lblBackupMode (TLabel) }
  lblBackupMode := TLabel.Create(pageAutoBackup);
  lblBackupMode.Parent := pnlBackupMode;
  lblBackupMode.Enabled := True;
  lblBackupMode.Visible := True;
  lblBackupMode.Width := pnlBackupMode.Width;
  lblBackupMode.Caption := ExpandConstant('{cm:lblBackupMode}');

  { radBackupModeAuto (TNewRadioButton) }
  radBackupModeAuto := TNewRadioButton.Create(pageAutoBackup);
  radBackupModeAuto.Parent := pnlBackupMode;
  radBackupModeAuto.Enabled := True;
  radBackupModeAuto.Visible := True;
  radBackupModeAuto.Left := ScaleX(0);
  radBackupModeAuto.Top := lblBackupMode.Top   lblBackupMode.Height   ScaleY(2);
  radBackupModeAuto.Width := pnlBackupMode.Width;
  radBackupModeAuto.Height := ScaleY(radBackupModeAuto.Height);
  radBackupModeAuto.Checked := False;
  radBackupModeAuto.Caption := ExpandConstant('{cm:radBackupModeAuto}');

  { radBackupModeManual (TNewRadioButton) }
  radBackupModeManual := TNewRadioButton.Create(pageAutoBackup);
  radBackupModeManual.Parent := pnlBackupMode;
  radBackupModeManual.Enabled := True;
  radBackupModeManual.Visible := True;
  radBackupModeManual.Top := radBackupModeAuto.Top   radBackupModeAuto.Height   ScaleY(2);
  radBackupModeManual.Width := pnlBackupMode.Width;
  radBackupModeManual.Height := ScaleY(radBackupModeManual.Height);
  radBackupModeManual.Checked := False;
  radBackupModeManual.Caption := ExpandConstant('{cm:radBackupModeManual}');

  { lblPromptMode (TLabel) }
  lblPromptMode := TLabel.Create(pageAutoBackup);
  lblPromptMode.Parent := pnlBackupMode;
  lblPromptMode.Enabled := True;
  lblPromptMode.Visible := True;
  lblPromptMode.Top := radBackupModeManual.Top   radBackupModeManual.Height   ScaleY(10);
  lblPromptMode.Width := pnlBackupMode.Width;
  lblPromptMode.Caption := ExpandConstant('{cm:lblPromptMode}');

  { cmbPromptMode (TNewComboBox) }
  cmbPromptMode := TNewComboBox.Create(pageAutoBackup);
  cmbPromptMode.Parent := pnlBackupMode;
  cmbPromptMode.Style := csDropDownList;
  cmbPromptMode.Enabled := True;
  cmbPromptMode.Visible := True;
  cmbPromptMode.Top := lblPromptMode.Top   lblPromptMode.Height   ScaleY(5);
  cmbPromptMode.Width := pnlBackupMode.Width;
  cmbPromptMode.ItemIndex := 0;
  cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemNever}'));
  cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemDaily}'));
  cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemWeekly}'));
  cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemMonthly}'));
  cmbPromptMode.Anchors := [akLeft, akRight];

  { Now we can set the panel height! }
  pnlBackupMode.ClientHeight :=
          (cmbPromptMode.Top   cmbPromptMode.Height)   ScaleY(5);

  { lblBackupFolder (TLabel) }
  lblBackupFolder := TLabel.Create(pageAutoBackup);
  lblBackupFolder.Parent := pageAutoBackup.Surface;
  lblBackupFolder.Enabled := True;
  lblBackupFolder.Visible := True;
  lblBackupFolder.Top := pnlBackupMode.Top   pnlBackupMode.Height   ScaleY(2);
  lblBackupFolder.Width := pnlBackupMode.Width;
  lblBackupFolder.Caption := ExpandConstant('{cm:lblBackupFolder}');   
  lblBackupFolder.Anchors := [akLeft, akRight, akBottom];

  { txtBackupFolder (TNewEdit) }
  txtBackupFolder := TNewEdit.Create(pageAutoBackup);
  txtBackupFolder.Parent := pageAutoBackup.Surface;
  txtBackupFolder.Enabled := True;
  txtBackupFolder.ReadOnly := True;
  txtBackupFolder.Visible := True;
  txtBackupFolder.Top := lblBackupFolder.Top   lblBackupFolder.Height   ScaleY(5);
  txtBackupFolder.Anchors := [akLeft, akRight, akBottom];

  { btnSelectBackupFolder (TNewButton) }
  btnSelectBackupFolder := TNewButton.Create(pageAutoBackup);
  btnSelectBackupFolder.Parent := pageAutoBackup.Surface;
  btnSelectBackupFolder.Enabled := True;
  btnSelectBackupFolder.Visible := True;
  btnSelectBackupFolder.Left := pageAutoBackup.Surface.Width - WizardForm.CancelButton.Width;
  btnSelectBackupFolder.Top := txtBackupFolder.Top;
  btnSelectBackupFolder.Width := WizardForm.CancelButton.Width;
  btnSelectBackupFolder.Height := WizardForm.CancelButton.Height;
  btnSelectBackupFolder.Caption := SetupMessage(msgButtonBrowse);   
  btnSelectBackupFolder.Anchors := [akRight, akBottom];
  btnSelectBackupFolder.OnClick := @btnSelectBackupFolder_Click;
  
  { Now we can set the text box width!
    Use the gap between the Next and Cancel buttons for consistency.}
  iButtonGap := WizardForm.CancelButton.Left -
                      (WizardForm.NextButton.Left   WizardForm.NextButton.Width);
  txtBackupFolder.Width := 
          pageAutoBackup.Surface.Width - btnSelectBackupFolder.Width - iButtonGap;

  Result := pageAutoBackup.ID;

end;

function GetWhatToBackupMode(Param: string): string;
begin

  if(radBackupWhatComplete.Checked) then
  begin
    Log('What to backup: Complete backup mode selected.');
    Result := IntToStr(BackupWhat_Complete);
  end
  else if(radBackupWhatEssential.Checked) then
  begin
    Log('What to backup: Essential backup mode selected.');
    Result := IntToStr(BackupWhat_Essential);
  end
  else begin
    Log('What to backup: No backup mode selected.');
    Result := IntToStr(BackupWhat_None);
  end;
end;
  
function GetHowToBackupMode (Param: string): string;
begin

  if(radBackupModeManual.Checked) then
  begin
    Log('How to backup: Perform the backup manually.');
    Result := IntToStr(BackupMode_Manual);
  end
  else begin
    Log('How to backup: Perform the backup automatically.');
    Result := IntToStr(BackupMode_Automatic);
  end;
end;

function GetBackupPromptMode (Param: string): string;
begin
  Log('Where to backup: '    cmbPromptMode.Items[cmbPromptMode.ItemIndex]);
  Result := IntToStr(cmbPromptMode.ItemIndex);
end;

function GetBackupLocationPath (Param: string): string;
begin
  // If empty, use the app folder and create a backup folder (Param)
  Log(txtBackupFolder.Text);
  Result := txtBackupFolder.Text;
end;

procedure AutoBackupPage_InitializeWizard(AfterId: Integer);
var
  dwBackupAtShutdownWhat: Cardinal;
  dwBackupAtShutdownHow: Cardinal;
  dwBackupPromptMode: Cardinal;
  strBackupFolder: String;
begin
  pageAutoBackup_CreatePage(AfterId);

  { What to Backup }
  dwBackupAtShutdownWhat := BackupWhat_None;
  if (IsWin64) then
  begin
    RegQueryDWordValue(HKLM64,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupAtShutdownWhat', dwBackupAtShutdownWhat)
  end else
  begin
    RegQueryDWordValue(HKLM,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupAtShutdownWhat', dwBackupAtShutdownWhat);
  end;

  if (dwBackupAtShutdownWhat = BackupWhat_Complete) then
  begin
    radBackupWhatComplete.Checked := True;
  end
  else if (dwBackupAtShutdownWhat = BackupWhat_Essential) then
  begin
    radBackupWhatEssential.Checked := True;
  end
  else begin
    radBackupWhatNone.Checked := True;
  end;

  { How to Backup }
  dwBackupAtShutdownHow := BackupMode_Automatic;
  if (IsWin64) then
  begin
    RegQueryDWordValue(HKLM64,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupAtShutdownMode', dwBackupAtShutdownHow);
  end else
  begin
    RegQueryDWordValue(HKLM,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupAtShutdownMode', dwBackupAtShutdownHow);
  end;

  if (dwBackupAtShutdownHow = BackupMode_Manual) then
  begin
    radBackupModeManual.Checked := True;
  end
  else begin
    radBackupModeAuto.Checked := True;
  end;

  { Backup Prompt Mode }
  dwBackupPromptMode := BackupPrompt_Never;
  if (IsWin64) then
  begin
  RegQueryDWordValue(HKLM64,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupPromptMode', dwBackupPromptMode);
  end else
  begin
    RegQueryDWordValue(HKLM,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupPromptMode', dwBackupPromptMode);
  end;
  cmbPromptMode.ItemIndex  := dwBackupPromptMode;

  { Backup Local Path }
  strBackupFolder := '';
  if (IsWin64) then
  begin
    RegQueryStringValue(HKLM64,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupAtShutdownLocalPath', strBackupFolder);
  end else
  begin
    RegQueryStringValue(HKLM,
            'SoftwareMeetSchedAssistMeeting Schedule AssistantOptions',
            'BackupAtShutdownLocalPath', strBackupFolder);
  end;
  
  { Do we need to reset the existing folder? }
  if(not DirExists(strBackupFolder)) then strBackupFolder :=  '';
  
  txtBackupFolder.Text  := strBackupFolder;
end;

procedure AutoBackupPage_CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = pageAutoBackup.ID then
  begin
    { Get the state of the Next button correct }
    if(radBackupWhatNone.Checked) then
      Wizardform.NextButton.Enabled := True
    else
      Wizardform.NextButton.Enabled := DirExists(txtBackupFolder.Text);
    WizardForm.Update;
  end;
end;

{ Build the Memo text for the Auto Backup Settings page }
function AutoBackupPage_MemoInfo(Space, NewLine: String): String;
begin
  Result := Result   ExpandConstant('{cm:pageAutoBackupTitle}')   NewLine;

  { What to Backup }
  Result := Result   Space   ExpandConstant('{cm:lblBackupWhat}')   NewLine;
  if(radBackupWhatNone.Checked) then
    Result := Result   Space   Space   ExpandConstant('{cm:radBackupWhatNone}')   NewLine;
  if(radBackupWhatComplete.Checked) then
    Result := Result   Space   Space   ExpandConstant('{cm:radBackupWhatComplete}')   NewLine;
  if(radBackupWhatEssential.Checked) then
    Result := Result   Space   Space   ExpandConstant('{cm:radBackupWhatEssential}')   NewLine;

  if(radBackupWhatNone.Checked = False) then
  begin
    { How to Backup }
    Result := Result   Space   ExpandConstant('{cm:lblBackupMode}')   NewLine;
    if(radBackupModeAuto.Checked) then
      Result := Result   Space   Space   ExpandConstant('{cm:radBackupModeAuto}')   NewLine;
    if(radBackupModeManual.Checked) then
      Result := Result   Space   Space   ExpandConstant('{cm:radBackupModeManual}')   NewLine;

    { Prompt Mode }
    Result := Result   Space   Space   ExpandConstant('{cm:lblPromptMode}')   NewLine;
    if(cmbPromptMode.ItemIndex = BackupPrompt_Never) then
      Result := Result   Space   Space   Space   ExpandConstant('{cm:cmbPromptModeItemNever}')   NewLine;
    if(cmbPromptMode.ItemIndex = BackupPrompt_Daily) then
      Result := Result   Space   Space   Space   ExpandConstant('{cm:cmbPromptModeItemDaily}')   NewLine;
    if(cmbPromptMode.ItemIndex = BackupPrompt_Weekly) then
      Result := Result   Space   Space   Space   ExpandConstant('{cm:cmbPromptModeItemWeekly}')   NewLine;
    if(cmbPromptMode.ItemIndex = BackupPrompt_Monthly) then
      Result := Result   Space   Space   Space   ExpandConstant('{cm:cmbPromptModeItemMonthly}')   NewLine;

    { Backup Folder }
    Result := Result   Space   ExpandConstant('{cm:lblBackupFolder}')   NewLine;
    Result := Result   Space   Space   txtBackupFolder.Text   NewLine;
  end;
  Result := Result   NewLine;

end;
 

Я использую скининг, как вы можете видеть ( #define Skin "Amakrits.vsf" ).

Я не ожидал этой проблемы с рендерингом.

Ответ №1:

У меня отлично работает в последней версии Win 10.

  1. На вашем рисунке показано, что вы выбрали опцию «Не выполнять …» , которая отключает элементы управления в следующей группе, поэтому элементы управления имеют разные цвета.
  2. Вносили ли вы какие-либо изменения в файл обложки Amakrits.vsf? Мой скин выглядит по-другому (я скачал его с GitHub несколько минут назад), и, похоже, в моем случае отсутствуют некоторые настройки.

Вывод: это не проблема с настройкой Inno, а проблема в плагине скининга VCL (попробуйте опубликовать свою проблему здесь: https://github.com/RRUZ/vcl-styles-plugins/issues ), но, похоже, его можно улучшить, изменив цвета в используемом файле .vsf.

P.S. ваш скрипт не мог быть скомпилирован правильно, так как отсутствовали пользовательские сообщения и функции инициализации скина / настройки.

Моя настройка

Комментарии:

1. Спасибо за ваш ответ. Я могу добавить пользовательские сообщения для полноты ответа на вопрос, если вы считаете это оправданным? Я подтверждаю, что цвета смешные, когда элементы управления отключены (на Mac). Я предполагаю, что я, должно быть, изменил скин, хотя я вообще не разбираюсь в цветах (поскольку я дальтоник). Вот мой скин: dropbox.com/s/2ihy1bnu5z6nke3/Amakrits.vsf?dl=0