Selected Text in font combobox ScaleRichviewEditor

General TRichView support forum. Please post your questions here
Post Reply
tomr
Posts: 27
Joined: Wed Dec 09, 2020 9:36 am

Selected Text in font combobox ScaleRichviewEditor

Post 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 885 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 885 times
Is there a way that the fontcombobox has no intial selection?
Sergey Tkachenko
Site Admin
Posts: 17839
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Selected Text in font combobox ScaleRichviewEditor

Post 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.
Post Reply