Forum > RichMemo

[solved] RichMemo - how to get the range text style?


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]);


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  fontparams: TFontParams;begin  if RichMemo1.GetTextAttributes(RichMemo1.SelStart, fontparams) then  begin    if fsBold in fontparams.Style then      ShowMessage('Font is bold');  end;   end;

This works nicely, many thanks!  :-*


[0] Message Index

Go to full version