Recent

Author Topic: [solved] RichMemo - how to get the range text style?  (Read 243 times)

Nicole

  • Sr. Member
  • ****
  • Posts: 453
[solved] RichMemo - how to get the range text style?
« on: July 15, 2022, 04:43:39 pm »
I tried a lot, but nothing worked.
How can I figure out, if the selected text is bold already?
Please be careful with links, as I have 2 links with code, which were NOT working any more.
The component TRichmemo seems to change from now and then.

These 2 lines below work today / first line sets to bold / second line, sets back to "not bold".
What is missing still, is the "if bold then...else ... condition"

   RichMemo_Notizen.SetRangeParams(RichMemo_Notizen.SelStart, RichMemo_Notizen.SelLength,[tmm_Styles],'',0,0,[fsbold], [])

   RichMemo_Notizen.SetRangeParams(RichMemo_Notizen.SelStart, RichMemo_Notizen.SelLength,[tmm_Styles],'',0,0,[], [fsbold]);
« Last Edit: July 15, 2022, 06:00:11 pm by Nicole »

paweld

  • Hero Member
  • *****
  • Posts: 512
Re: RichMemo - how to get the range text style?
« Reply #1 on: July 15, 2022, 05:38:56 pm »
Code: Pascal  [Select][+][-]
  1. var
  2.   fontparams: TFontParams;
  3. begin
  4.   if RichMemo1.GetTextAttributes(RichMemo1.SelStart, fontparams) then
  5.   begin
  6.     if fsBold in fontparams.Style then
  7.       ShowMessage('Font is bold');
  8.   end;  
  9. end;
Best regards
paweld

Nicole

  • Sr. Member
  • ****
  • Posts: 453
Re: RichMemo - how to get the range text style?
« Reply #2 on: July 15, 2022, 05:59:43 pm »
This works nicely, many thanks!  :-*

 

TinyPortal © 2005-2018