DBRichEdit Justify
I have a method to justify a richedit
procedure TfEdResultadoTexto.ActAlinearJustificarExecute(Sender:
TObject);
var x :tparaformat;
L :LongInt;
cp :charrange;
begin
x.cbSize := sizeof(x);
if Editor.SelLength = 0 then begin
cp.cpMin := 0;
cp.cpMax := length(Text);
SendMessage(Editor.Handle,EM_EXSETSEL,mZERO,LPARAM(@cp));
end;
L := SendMessageA(Editor.Handle,EM_SETTYPOGRAPHYOPTIONS,
TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
if L = 1 then begin
SendMessageA(Editor.Handle, EM_GETTYPOGRAPHYOPTIONS, mZERO,
mZERO);
SendMessage(Editor.Handle, EM_GETPARAFORMAT, mZERO, LPARAM(@x));
x.dwMask := PFM_ALIGNMENT;
x.wAlignment := PFA_JUSTIFY;
SendMessage(Editor.Handle, EM_SETPARAFORMAT, mZERO, lparam(@x));
end;
cp.cpMin := 0;
cp.cpMax := 0;
SendMessage(Editor.Handle,EM_EXSETSEL,mZERO,lparam(@cp));
Editor.WordWrap := true;
end;
How can i apply this method to a report to justify the text.
Thanks
--
procedure TfEdResultadoTexto.ActAlinearJustificarExecute(Sender:
TObject);
var x :tparaformat;
L :LongInt;
cp :charrange;
begin
x.cbSize := sizeof(x);
if Editor.SelLength = 0 then begin
cp.cpMin := 0;
cp.cpMax := length(Text);
SendMessage(Editor.Handle,EM_EXSETSEL,mZERO,LPARAM(@cp));
end;
L := SendMessageA(Editor.Handle,EM_SETTYPOGRAPHYOPTIONS,
TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
if L = 1 then begin
SendMessageA(Editor.Handle, EM_GETTYPOGRAPHYOPTIONS, mZERO,
mZERO);
SendMessage(Editor.Handle, EM_GETPARAFORMAT, mZERO, LPARAM(@x));
x.dwMask := PFM_ALIGNMENT;
x.wAlignment := PFA_JUSTIFY;
SendMessage(Editor.Handle, EM_SETPARAFORMAT, mZERO, lparam(@x));
end;
cp.cpMin := 0;
cp.cpMax := 0;
SendMessage(Editor.Handle,EM_EXSETSEL,mZERO,lparam(@cp));
Editor.WordWrap := true;
end;
How can i apply this method to a report to justify the text.
Thanks
--
This discussion has been closed.
Comments
The TppRichText creates a TRichEdit to use internally, but it is not exposed
via a property. You could try using the TppRichText.Components[ ] array to
gain access to it (TppRichText is the Owner of the TRichEdit).
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
RAP event OnPrint, OnGetRichText, the function is executed but the text
is not aligned. In the application Richedit, the text is displayed
justified, but not in RB. Do you override properties after calling this
events?
Thanks
procedure TraRichEditJustify.ExecuteFunction(aParams: TraParamList);
var lRichText: TppRichText;
lRichEdit: TRichEdit;
iCnt: integer;
x :tparaformat;
L :LongInt;
cp :charrange;
begin
GetParamValue(0, lRichText );
for iCnt := 0 to lRichText.ComponentCount - 1 do begin
if( lRichText.Components[ iCnt ] is TRichEdit )then begin
lRichEdit := TRichEdit(lRichText.Components[ iCnt ]);
x.cbSize := sizeof(x);
if lRichEdit.SelLength = 0 then begin
cp.cpMin := 0;
cp.cpMax := length(lRichEdit.Text);
SendMessage(lRichEdit.Handle,EM_EXSETSEL,mZERO,LPARAM(@cp));
end;
L := SendMessageA(lRichEdit.Handle,EM_SETTYPOGRAPHYOPTIONS,
TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
if L = 1 then begin
SendMessageA(lRichEdit.Handle, EM_GETTYPOGRAPHYOPTIONS,
mZERO, mZERO);
SendMessage(lRichEdit.Handle, EM_GETPARAFORMAT, mZERO,
LPARAM(@x));
x.dwMask := PFM_ALIGNMENT;
x.wAlignment := PFA_JUSTIFY;
SendMessage(lRichEdit.Handle, EM_SETPARAFORMAT, mZERO,
lparam(@x));
end;
cp.cpMin := 0;
cp.cpMax := 0;
SendMessage(lRichEdit.Handle,EM_EXSETSEL,mZERO,lparam(@cp));
lRichEdit.WordWrap := true;
end;
end;
end;
--