Page 1 of 1

TABs not accounted for in 'natural' width (AreaWidth)?

Posted: Mon Aug 04, 2008 8:38 am
by lwinter
When calling AreaWidth or TextWidth or DocumentWidth of TCustomRVFormattedData that contains TAB characters, then the resulting value is less than the actual 'natural' width of the content. The difference seems to be width of the TABs, their width seems to be omitted.

I have set TRichViewEdit to

Code: Select all

Options := Options-[rvoClientTextWidth];
Style.ParaStyles[count].Options := Style.ParaStyles[count].Options+[rvpaoNoWrap];
MinTextWidth := 0;
MaxTextWidth := 0;
Width := 0;
ReFormat;
How can I get the 'natural' width of RichView content that has TABs?
(I'm using RichView1.9)

Thanks! -- Lutz

Posted: Tue Aug 05, 2008 5:57 am
by lwinter
Actually, each TAB always seems to account for 20 screen pixels, regardless if
Style.DefTabWidth > 20 or Style.DefTabWidth < 20
and regardless of assigning any tabstops of any position in
Style.ParaStyles[].Tabs

In other words, AreaWidth (minus margins), DocumentWidth and TextWidth ONLY give the correct natural width, when
Style.DefTabWidth = 20
Style.ParaStyles[].Tabs.count = 0


Is there a workaround for this in V 1.9? Is this fixed in V 2.7?

Thanks,
-- Lutz

Posted: Tue Aug 05, 2008 3:24 pm
by Sergey Tkachenko
Tabs cannot affect text/document width (except for paragraph where wrapping is turned off). If the tab exceeds the document width, it is moved to the new line.
DefTabWidth does not actually define widths of tabs, it defines tab positions.