Board index » delphi » RichEdit Indents

RichEdit Indents

Does anyone know what the deal is with FirstIndent and LeftIndent using the
RTF control.  The documentation indicates that FirstIndent is supposed to
indent the first line of a paragraph, but instead, it indents the entire
paragraph -- which is what I thought LeftIndent was supposed to do.  I can
live with that problem as long as I know it is consistent.  But, LeftIndent
(instead of working the way I thought it should), works kind of the opposite
of what I thought a FirstIndent was supposed to do.  It unindents the first
line of the paragraph -- or more specifically, it indents all but the first
line of text.

I'm using NT 4.0 and wonder if this is an NT problem or a VCL problem?  Can
anyone help?

Mike

 

Re:RichEdit Indents


Quote
In article <8a30ki$4...@bornews.borland.com>, Mike Mayes wrote:
> Does anyone know what the deal is with FirstIndent and LeftIndent using the
> RTF control.  The documentation indicates that FirstIndent is supposed to
> indent the first line of a paragraph, but instead, it indents the entire
> paragraph -- which is what I thought LeftIndent was supposed to do.  I can
> live with that problem as long as I know it is consistent.  But, LeftIndent
> (instead of working the way I thought it should), works kind of the opposite
> of what I thought a FirstIndent was supposed to do.  It unindents the first
> line of the paragraph -- or more specifically, it indents all but the first
> line of text.

The documentation is misleading, these two properties are not independent of
each other. The map to two fields of the Windows PARAFORMAT record, which is
used to set paragroph properties in a rich edit control by sending it a
EM_SETPARAFORMAT message. The two fields are

<quote from win32.hlp, PARAFORMAT topic>
dxStartIndent

Indentation of the first line in the paragraph. If the paragraph formatting is
being set and PFM_OFFSETINDENT is specified, this member is treated as a
relative value that is added to the starting indentation of each affected
paragraph.

dxOffset

Indentation of the second line and subsequent lines, relative to the starting
indentation. The first line is indented if this member is negative, or
outdented is this member is positive.
</quote>

FirstIndent maps to dxStartIndent, LeftIndent maps to dxOffset. Perhaps this
info makes the observed behaviour a bit clearer. The VCL does not use
PFM_OFFSETINDENT, by the way.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Sent using Virtual Access 5.00 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Re:RichEdit Indents


Thanks very much for the help, but I still have one problem I have not been
able to overcome.

When I change the value of dxOffset, the indentation formatting takes place
immediately.  Then, when I save the RTF as a file, I can see the \lixxx
value in the file, so I know it is a non-zero value.  But, when I read the
file back into the RichEdit control (using loadfromfile), dxOffset is reset
to zero.  I can see that immediately by the invalid indenting and by viewing
the value of dxOffset in the IDE.  Do you know of a way to overcome this
problem?  Is it a bug?

Thanks for any help.

Mike

"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message
news:VA.000049be.00adec1b@antispam.compuserve.com...

Quote
> In article <8a30ki$4...@bornews.borland.com>, Mike Mayes wrote:
> > Does anyone know what the deal is with FirstIndent and LeftIndent using
the
> > RTF control.  The documentation indicates that FirstIndent is supposed
to
> > indent the first line of a paragraph, but instead, it indents the entire
> > paragraph -- which is what I thought LeftIndent was supposed to do.  I
can
> > live with that problem as long as I know it is consistent.  But,
LeftIndent
> > (instead of working the way I thought it should), works kind of the
opposite
> > of what I thought a FirstIndent was supposed to do.  It unindents the
first
> > line of the paragraph -- or more specifically, it indents all but the
first
> > line of text.

> The documentation is misleading, these two properties are not independent
of
> each other. The map to two fields of the Windows PARAFORMAT record, which
is
> used to set paragroph properties in a rich edit control by sending it a
> EM_SETPARAFORMAT message. The two fields are

> <quote from win32.hlp, PARAFORMAT topic>
> dxStartIndent

> Indentation of the first line in the paragraph. If the paragraph
formatting is
> being set and PFM_OFFSETINDENT is specified, this member is treated as a
> relative value that is added to the starting indentation of each affected
> paragraph.

> dxOffset

> Indentation of the second line and subsequent lines, relative to the
starting
> indentation. The first line is indented if this member is negative, or
> outdented is this member is positive.
> </quote>

> FirstIndent maps to dxStartIndent, LeftIndent maps to dxOffset. Perhaps
this
> info makes the observed behaviour a bit clearer. The VCL does not use
> PFM_OFFSETINDENT, by the way.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

> Sent using Virtual Access 5.00 - download your freeware copy now
> http://www.atlantic-coast.com/downloads/vasetup.exe

Re:RichEdit Indents


Quote
In article <8abhde$j...@bornews.borland.com>, Mike Mayes wrote:
> When I change the value of dxOffset, the indentation formatting takes place
> immediately.  Then, when I save the RTF as a file, I can see the \lixxx
> value in the file, so I know it is a non-zero value.  But, when I read the
> file back into the RichEdit control (using loadfromfile), dxOffset is reset
> to zero.  I can see that immediately by the invalid indenting and by viewing
> the value of dxOffset in the IDE.  Do you know of a way to overcome this
> problem?  Is it a bug?

It seems to be a bug in the MS common control itself, since Wordpad has
exactly the same problem. I know no way around it, sorry.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Sent using Virtual Access 5.00 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Other Threads