Column Drag & Drop
SftTree/DLL can be enabled to allow users of the control to reorder columns by dragging a column and dropping it at the new position in the control. The application can define certain columns that must remain in their current position (see SFTTREE_COLUMN_EX, colFlag member, SFTTREE_COL_KEEPPOS). Columns that must remain in their current position cannot be moved.
As a user reorders columns, this is completely transparent to the application. An application still references by the "real" column number, which is the original column number that the had before columns were reordered by the user. While columns appear in a new order after dragging a column to a new position, the application references columns and by their real column number which never changes.
A user can drag a column by clicking the left mouse button on a column header and, without releasing the mouse button, move the cursor to a new location. A vertical bar indicates the location where the column will be inserted. Once the correct position is reached, the user releases the mouse button. An application receives the SFTTREEN_REORDERED notification after the column positions have been changed.
While a column drag & drop is in progress, the user can abort it by pressing the Escape key.
When using a split tree control, columns can only be reordered within one pane. They cannot be moved from one pane to the other.
If an application wants to retain the column order between sessions, the dispPos member of the SFTTREE_COLUMN_EX structure must be saved for each column. When the application is restarted and the tree control is reinitialized, the values of the dispPos member can be restored for each column before calling SetColumns. An INI file or the Windows Registry can be used to save these values.
The SftTree/DLL Wizard can be used to view events that are generated by the tree control.