Recent

Author Topic: SynEdit change font size  (Read 173 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
SynEdit change font size
« on: June 18, 2026, 06:58:07 pm »
Hello i tried to change font size on synedit but don't let me change
Code: Pascal  [Select][+][-]
  1.  if FontDialog1.Execute then begin
  2.     SEdit.Font := FontDialog1.Font;
  3.     SEdit.Font.Size:= FontDialog1.Font.Size;
  4.     SEdit.Font.Style:= FontDialog1.Font.Style;
  5.     SEdit.Refresh;
  6.   end;
  7.  

what i doing wrong...?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12561
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit change font size
« Reply #1 on: June 18, 2026, 08:26:59 pm »
Did you by any change assign something to
  SynEdit.Font.Onchang :=
?

SynEdit get font from TControl, and due to limitations, SynEdit must have that event itself. Otherwise it wont work. (Or you must call SynEdit.FontChanged(SynEdit.Font); / but that is protected, so you would need a class helper...)

IIRC there is already a reported issue, but not sure...



Otherwise it should work. You either need to only assign the entire font OR the properties of interest. Doing both (as you do) is fine, but not needed.

dsiders

  • Hero Member
  • *****
  • Posts: 1657
Re: SynEdit change font size
« Reply #2 on: June 18, 2026, 09:50:36 pm »
Hello i tried to change font size on synedit but don't let me change
Code: Pascal  [Select][+][-]
  1.  if FontDialog1.Execute then begin
  2.     SEdit.Font := FontDialog1.Font;
  3.     SEdit.Font.Size:= FontDialog1.Font.Size;
  4.     SEdit.Font.Style:= FontDialog1.Font.Style;
  5.     SEdit.Refresh;
  6.   end;
  7.  

what i doing wrong...?

Not sure... but here's a simple demo to show that it works as expected.

 

TinyPortal © 2005-2018