[TSynMemo] Set new line color / font style lazarus / 31-LCL ---------------------------------------------------------------------- totya · 2015-04-14 20:36 Hi! Is there any way to set next line color/font style (example: bold) in TSynMemo? Thanks. ---------------------------------------------------------------------- Martin_fr · 2015-04-14 21:32 First: http://wiki.lazarus.freepascal.org/Lazarus_1.6.0_release_notes#SynMemo _is_now_Deprecated If you mean like richedit: no. If you want to highlight a line: Code: [Select]SynEdit.OnSpecialLineMarkup Code: [Select]procedure TForm1.SynEdit1SpecialLineMarkup(Sender: TObject; Line: integer;   var Special: boolean; Markup: TSynSelectedColor); begin   Special := line = SynEdit1.CaretY+1; // Markup will be applied, if special is true   Markup.Clear;   Markup.Style := [fsBold]; end; "line = SynEdit1.CaretY+1;" That is if "next line" means line below caret. If you want line 24 then "line = 25" ---------------------------------------------------------------------- totya · 2015-04-15 15:38 Hi! Thanks for answer, but above code doensn't work: Code: [Select]SynEdit.OnSpecialLineMarkup Result: Code: [Select]unit1.pas(47,31) Error: Wrong number of parameters specified for call to "" ---------------------------------------------------------------------- Martin_fr · 2015-04-15 16:53 OnSpecialLineMarkup is an event. You can assign it in the object inspector. or you can do SynEdit1.OnSpecialLineMarkup := @yourmethod Where yourmethod is a procedure on a class, having the correct param list (see 2nd code snippet) ---------------------------------------------------------------------- totya · 2015-04-15 18:04 Quote from: Martin_fr on April 15, 2015, 06:53:54 pmOnSpecialLineMarkup is an event. You can assign it in the object inspector. Hi! Okay, I wrote few applications, my largest project contains about five-thousand lines, well, I know what is the event. Well, I don't see how can I use this event, please write a working example, if possible. For example: procedure NextLineIsBold; or procedure NextLineTextColor (const color:TColor); etc... My example (with your event code): Code: [Select]procedure TForm1.Button1Click(Sender: TObject); begin   SynEdit1.Lines.Add(Edit1.Text); end; The second line is bold only. I want to choice, which line is bold, and which line is not. QuoteMarkup will be applied, if special is true Okay, I think I don't call this event directly, how can I change "special" variable? ps.: on TSynEdit F1 or ctrl-F1 result is nothing (no help found for...) Thanks for your help! ---------------------------------------------------------------------- Martin_fr · 2015-04-15 18:55 See attached.  Line 3 is bold. Event is set in Object Inspector. Now I still do not know that you mean by "next line". The example allows you to apply attributes to any line, but you need to maintain the lines yourself. If lines are edited, you must update. There is nothing, that would allow you to say add attribute to current line 3, and remember. The text itself does not store any attributes. If you need that its richedit. There is also a highlighter SynAnySyn but again, you give it fixed points, and they do NOT update if text is edited. You can write your own highlighter http://wiki.lazarus.freepascal.org/SynEdit_Highlighter But if you are looking at lines, then maybe a markup  TSynEditMarkup is better. Or just use the event. ---------------------------------------------------------------------- totya · 2015-05-15 21:21 Hi! Tahnks for the answer, but seems to me TRichMemo is the better choice of me.