SftTree/OCX 7.5 Documentation

Column Resizing

A SftTree/OCX control can define multiple columns, each with its individual text alignment (left, right, center). A tree control can also define a header with titles, each with its individual text alignment. Columns can be resized by the user without application program intervention (unless disabled by the application using Headers.Resizable). By dragging the separator between titles (or buttons), users can adjust column widths to their particular needs. An application receives the ColumnSize event as the column sizes change.

If the user resizes a column and makes it so small that its column width becomes 0, the next column to the left may also be affected (made smaller) in the same resizing operation, based on the settings of the Headers.Resizable property.

Columns can be defined with a minimum column width (see the Column.MinWidth property). This will prevent the user from hiding a column. The user is unable to make the column smaller than the minimum width defined. However, an application can still make the column smaller using properties and methods such as Column.MakeOptimal, etc.

When a user is about to resize a column, the ColumnSizeStarted event occurs (as the user presses the left mouse button in the column resizing area, before the column width changes). As the column is resized, the ColumnSize event can occur multiple times. Once the user releases the mouse button used to resize the column, the ColumnSizeEnded event occurs. These events also occur identically during splitter bar resizing.

If the resizing area of a column header is double-clicked, an ItemDblClick event occurs with an AreaType of constSftTreeColumnRes.

The application can define certain columns as locked (see Header.Locked). Columns that are locked cannot be resized. This could be useful for columns that contain a graphic which always has the same width. By using Column.MakeOptimal once to calculate the optimal width of the column, the column is wide enough to display all of its data, so there is no need to allow the user to resize it.

Locked columns are also useful to hide entire columns from a user, e.g., if a user does not have sufficient authorization to view some data, the application could still load all information into the control, yet hide selected columns by locking them and setting their width to 0. This simplifies program logic as the application can work with constant column numbers, yet the data is not shown to users with insufficient authority.

An application could save column widths as they have been altered by a user in an INI file or the registry for future use, using the Columns.Widths property.

Last Updated 04/28/2018 - (email)
© 2018 Softel vdm, Inc.