Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

Column Resizing

A SftTree/DLL 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). By dragging the separator between column titles (or buttons), users can adjust column widths to their particular needs. An application receives the SFTTREEN_COLUMNSIZE notification after the column sizes have been changed.

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 SetCrossColumnResize.

Columns can be defined with a minimum column width (see SFTTREE_COLUMN_EX, minWidth member). 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 functions such as MakeColumnOptimal, etc.

An application can define certain columns as locked (see SFTTREE_COLUMN_EX, SFTTREE_COL_LOCKED). Columns that are locked cannot be resized. This could be useful for columns that contain a picture which always has the same width. By using MakeColumnOptimal 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.

If the resizing area of a column header is double-clicked, a SFTTREEN_LBUTTONDBLCLK_COLUMNRES notification is generated. The application could resize the column using MakeColumnOptimal in response to the notification.

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.

The SftTree/DLL Wizard can be used to view events that are generated by the tree control.