Re:RichEdit tab stops vs Memo tab stops
Hi, Luke.
Quote
Luke Ulrich wrote:
> Hey,
> I am able to specify tab stops within a TMemo control by sending
> EM_SETTABSSTOPS message along with the respective parameters:
> short TabWidth[] = {4,7,10,13,16,19,22,25,28,31,34,37,40};
> for(int i=0; i<12; i++)
> TabWidth[i] = LOWORD(GetDialogBaseUnits()) * TabWidth[i] * 0.5;
> Memo1->Perform(EM_SETTABSTOPS, (WPARAM)1, (LPARAM)TabWidth);
> However, I have not gotten this to work with a TRichEdit control. Is
> there a way to specify the tab stops in a RichEdit?
This will not work as you expect it to work when using RE controls.
<sigh> If Borland had *not* attempted to make TRichEdit a descendant of
TCustomMemo, so many misconceptions could have been avoided.... Anyway,
the EM_GET/SETTABSTOPS messages do not work with TRichEdit. (The
message *does* work with RE 3.0 controls according to the documentation
that I have. However, all BCB TRichEdit controls are based upon RE 1.0,
so this helps not at all.)
To get beyond my pointless whining and answer the question, you can set
TRichEdit tabstops two ways:
(1) Use the TRichEdit::Paragraph::Tab property to set the tabstops.
Note that the units are in points regardless of any pre-BCB5 help
information. (BCB4 and prior help states that the units are pixels.
This is clearly wrong if you read the source code.)
(2) Use the Windows native EM_SETPARAFORMAT message. While this may
seem overkill, it gives you total control over the paragraph format.
Note that the units are twips (not points). You need not worry about
bypassing the VCL TRichEdit::Paragraph property -- it fetches the
attributes from the control whenever the Paragraph property is read.
You might want to check out http://home.att.net/~robertdunn/Yacs.html
for more information.
HTH.
robert