Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

RecalcHorizontalExtent Method, SftTree Object

Recalculates the optimal horizontal scrolling extent.

Deprecated - Provided for compatibility with earlier versions only - Use Items.RecalcHorizontalExtent instead

Syntax

VB.NETobject.RecalcHorizontalExtent()
VBobject.RecalcHorizontalExtent
C#.NETvoid object.RecalcHorizontalExtent();
VC++HRESULT object->RecalcHorizontalExtent();
CHRESULT object->raw_RecalcHorizontalExtent();

object

A SftTree object.

Comments

Deprecated - Provided for compatibility with earlier versions only - Use Items.RecalcHorizontalExtent instead

The RecalcHorizontalExtent method recalculates the optimal horizontal scrolling extent.

By default, a tree control does not handle horizontal scrolling, even if the Scrollbars property defines scroll bars to be available. To start horizontal scrolling, an application has to use the RecalcHorizontalExtent method or the Items.HorizontalExtent property. They indicate to the tree control that horizontal scrolling support is desired and allows it to determine the horizontal scrolling extent. Once the horizontal scrolling extent has been set, many tree control methods and properties may invalidate the horizontal extent. E.g., adding a new item may invalidate the extent, so it is best to delay using the RecalcHorizontalExtent method until after all items have been added, all properties have been set and the column widths have been defined.

The tree control doesn't automatically update the horizontal extent when items are added or deleted or other methods or properties are used, which may invalidate the horizontal extent. The RecalcHorizontalExtent method has to be used again to recalculate the extent.

Based on the definition of the last column, different algorithms are used to calculate the optimal scrolling extent. Using the ColumnsObj.OpenEnded property, the last column can be defined as open-ended, which is the default if the application doesn't define any columns. An open-ended last column will display the complete text and graphics specified for the last (or only) column and never truncate any data. A fixed-width last column is defined with a specified width and any data which doesn't fit is truncated.

Open-Ended Last Column

Recalculating the best horizontal scrolling extent can be a costly operation (in terms of elapsed time). When updating a tree control, it is best to delay using the RecalcHorizontalExtent method as much as possible. It is best done after all items have been added, their levels have been set and all necessary graphics and tree control attributes have been defined, because most changes to the tree control can invalidate the optimal horizontal scrolling extent calculated.

When calculating the optimal scrolling extent, each item will be analyzed and its length calculated using the item's text and graphic components and its level. The widest item determines the horizontal scrolling extent.

Calculating the optimal horizontal extent can be a time consuming operation, particularly if many items have been added to the tree control. RecalcHorizontalExtent scans all items to determine the best column width, but can be limited to a specific number of items using the Items.CalcLimit property. This reduces the time spent to calculate the optimal width, but may still leave some items clipped.

Fixed-Width Last Column

Recalculating the best horizontal scrolling extent is a very quick operation. The width of all columns and some initial overhead (based on the highest level number found) is calculated to determine the horizontal scrolling extent. No cell text is analyzed.

See Also SftTree Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.