Page 1 of 1

Problem with justify in TPrintPreview

PostPosted: October 24th, 2003, 3:52 pm
by Seb@stieN
If i open a RTF file with JUSTIFY paragraphe the preview don't justify can u help me?

PostPosted: October 24th, 2003, 7:13 pm
by Kambiz
I checked it out with v4.30 of TPrintPreview, and there was no pronlem.
Could you please post your RTF file here?

PostPosted: October 27th, 2003, 11:05 am
by Seb@stieN
I you're General Demo with sample file it's Ok
but
IN RichText Demo it's not OK the text it's not JUSTIFY with you're sample file. WHY and EXISTING A SOLUTION ? ? ?

PostPosted: October 27th, 2003, 4:37 pm
by Seb@stieN
To fix this problem i found a solution but it not very good but it work in version >2
IN
Code: Select all
PaintRichText

I ADD Declaration
Code: Select all
const
  EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202;
  TO_ADVANCEDTYPOGRAPHY   = 1;

AND
Code: Select all
SendMessage(RichEdit.Handle, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);

BEFORE
Code: Select all
Range.chrg.cpMin := SendMessage(RichEdit.Handle, EM_FORMATRANGE, 1, integer(@Range));


---
You can Change
TCustomRichEdit
BY
TCustomMemo
With this change you can use JvRichEdit and LMDRichEdit
Sory for my bad ENGLISH

PostPosted: October 27th, 2003, 11:32 pm
by Kambiz
Thanks Sebastian for the fix.

At least on Windows XP there's no problem with rendering justified rich text with the TPrintPreview component. The component doen't render the text itself, and it's the Windows's task to do it. Maybe there's a bug on some versions of common controls, however I don't know about it and it's not my fault, please don't blame me.

In addition, I won't change the parameter's type from TCustomRichEdit to TCustomMemo. A memo control doesn't support EM_FORMATRANGE message. If a rich edit control wrongly drived from a TCustomEdit instead of a TCustomRichEdit, I might not do the same mistake, shall I? If you are sure that the control is a rich edit, type cast it as what it should be, and pass it to the method.

PostPosted: October 28th, 2003, 7:51 am
by Seb@stieN
I don't blame you.
In internet i found Doc in Richedit controle and there are many version.

You can found some Doc :
http://home.att.net/~robertdunn/Yacs.html (for BCB)

You're preview it's very good