Page 1 of 1

Selected Text in font combobox ScaleRichviewEditor

Posted: Mon Jun 02, 2025 3:02 pm
by tomr
Hello Richview-Support,
while working with your ScaleRichView component I come up with the following question:
If I load the richviewactiontest demo and start the project. Now the font combobox has selected text.
ScaleRichview FontComboBox.png
ScaleRichview FontComboBox.png (21.1 KiB) Viewed 1630 times
If I open the richviewactiontest demo from the richviewedit and start the project, the font combobox is not selected.
Richview FontComboBox.png
Richview FontComboBox.png (19.45 KiB) Viewed 1630 times
Is there a way that the fontcombobox has no intial selection?

Re: Selected Text in font combobox ScaleRichviewEditor

Posted: Tue Jun 03, 2025 3:41 pm
by Sergey Tkachenko
The demo uses a workaround,

Code: Select all

const
    WM_DESELECTCOMBO = WM_USER + 1;
In the form's interface section:

Code: Select all

procedure WMDeselectCombo(var Msg: TMessage); message WM_DESELECTCOMBO;
procedure DeselectComboBoxes;
Implementation:

Code: Select all

procedure TForm3.DeselectComboBoxes;
begin
  cmbFontSize.SelLength := 0;
  cmbFont.SelLength:= 0;
end;

// The font combo box is displayed selected on start. Hiding its selection.
procedure TForm3.WMDeselectCombo(var Msg: TMessage);
begin
  DeselectComboBoxes;
end;
PostMessage(Handle, WM_DESELECTCOMBO, 0, 0) is called on FormShow and FormBeforeMonitorDpiChanged.
DeselectComboBoxes is called in btnLanguageClick.