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

General TRichView support forum. Please post your questions here
Post Reply
lwinter
Posts: 24
Joined: Thu Dec 01, 2005 4:42 am

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

Post 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
lwinter
Posts: 24
Joined: Thu Dec 01, 2005 4:42 am

Post 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
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply