Forum > RichMemo

[solved] TRichEdit into TRichMemo - can somebody help in code-translation

(1/1)

Nicole:
I want to portate the source below from Delphi TRichEdit into Lazarus TRichMemo.
It does nothing else, but work as alternating button to switch "formatted bold" on or off.

My problem, I do not know, how to translate:
"RichEdit_WICHTIG.SelAttributes.Style=[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";}};} ---[pre]// der ausgewählte Text wird fett gedruckt bzw. das Setting revidiertprocedure TForm_KalenderMain.SpeedButton_fettClick(Sender: TObject);begin     if RichEdit_WICHTIG.SelAttributes.Style=[fsBold] then begin       RichEdit_WICHTIG.SelAttributes.Style:=[]; // auf normal = default setzen       SpeedButton_fett.Font.Style:=[];       SpeedButton_fett.Down:=false;       exit; end;      // wenn es bereits fett ist, => wieder normal     RichEdit_WICHTIG.SelAttributes.Style:= [fsBold];    SpeedButton_fett.Font.Style:= [fsBold];end;[/pre][/color]

Zvoni:
First guess: https://wiki.freepascal.org/RichMemo#SetRangeParams

EDIT:
Second Guess: https://wiki.freepascal.org/RichMemo#TRichEditForMemo

--- Quote ---The class helper that implements RichEdit programmatic interface.

--- End quote ---

Third guess: https://wiki.freepascal.org/RichMemo#.28Delphi.29_RichEdit_like_interface

--- Quote ---you can use RichMemoHelpers unit (fpc 2.6.0 or later required) and use methods provided by class Helpers that should; Currently SelAttributes and Paragraph properties are implemented.

--- End quote ---

Nicole:
Thank you for the links!

This does it:

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

set not not bold
   RichMemo_Notizen.SetRangeParams(RichMemo_Notizen.SelStart,RichMemo_Notizen.SelLength,[tmm_Styles],'',0,0,[], [fsbold]);

Navigation

[0] Message Index

Go to full version