Delete fonts out of TRVFontComboBox

General TRichView support forum. Please post your questions here
Post Reply
WLemmermeyer
Posts: 11
Joined: Fri Jun 06, 2014 5:32 am
Location: Germany

Delete fonts out of TRVFontComboBox

Post by WLemmermeyer »

Hello,

We use right now V15.3.2 of TRichview, Upgrade to V17 maybe in the next Months
we try to eliminate some Fonts out of TRVFontComboBox. In the TRVFontComboBox.Build method there is a filter:

Code: Select all

procedure TRVFontComboBox.Build;
var SL: {$IFDEF USERVTNT}TTntStringList{$ELSE}TStringList{$ENDIF};
  i: Integer;
begin
  SL := {$IFDEF USERVTNT}TTntStringList{$ELSE}TStringList{$ENDIF}.Create;
  SL.Assign(Screen.Fonts);
  SL.BeginUpdate;
  for i := SL.Count-1 downto 0 do
    if (SL[i]='') or (SL[i][1]='@') then
      SL.Delete(i);
  SL.EndUpdate;
  Items := SL;
  SL.Free;
end;
to eliminate @ Fonts. Is it possible somehow to delete specific Fonts (eg FixedSys)? I try to delete the font in the Combobox-Items, but this doesn't work....
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Delete fonts out of TRVFontComboBox

Post by Sergey Tkachenko »

Probably you tried to delete items before they were added.
The combobox creates a list of fonts when its window handle is created.
So, if you want to access items, make sure that the handle is created:

Code: Select all

  RVFontComboBox1.HandleNeeded;
  Index := RVFontComboBox1.Items.IndexOf('Fixedsys');
  if Index >=0 then
    RVFontComboBox1.Items.Delete(Index);
Post Reply