Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBox.RecalcHorizontalExtent Method

Sets the optimal horizontal scrolling extent.

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

Syntax

VB.NETobject.RecalcHorizontalExtent(ByVal MaxScan As Integer)
VBobject.RecalcHorizontalExtent(ByVal MaxScan As Long)
C#.NETvoid object.RecalcHorizontalExtent(int MaxScan);
VC++HRESULT object->RecalcHorizontalExtent(long MaxScan);
CHRESULT object->raw_RecalcHorizontalExtent(long MaxScan);

object

A SftBox object.

MaxScan

The maximum number of items to be evaluated for horizontal scrolling calculation. If 0 is specified, all items will be considered.

Comments

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

The RecalcHorizontalExtent method sets the optimal horizontal scrolling extent.

By default, a combo box control does not handle horizontal scrolling, even if the Scrollbars property defines horizontal scroll bars to be available. To start horizontal scrolling, an application has to use the Items.RecalcHorizontalExtent method or the Items.HorizontalExtent property. They indicate to the 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 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 Items.RecalcHorizontalExtent method until after all items have been added, all properties have been set and the column widths have been defined.

The 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 Items.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 Columns.OpenEnded property, the last column can be defined as open-ended. 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 control, it is best to delay using the Items.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 control attributes have been defined, because most changes to the 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 control. Items.RecalcHorizontalExtent scans all items to determine the best column width, but can be limited to a specific number of items using the MaxScan argument. 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 SftBox Object | Object Hierarchy


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