Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

Column Resizing

A SftBox/OCX control can define multiple columns (Columns.Count), each with its individual text alignment (Column.CellHAlign and Column.CellVAlign). A combo box control can also define a header with titles, each with its individual text alignment (Header.Text, Header.TextHAlign and Header.TextHAlign).

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 columns to their particular needs. An application receives the ColumnSize event while the column sizes are changing.

Column resizing is usually also available by double-clicking on the resizing area of a column header. While this is not automatic, it is easily implemented using the ItemDblClk event:

Private Sub CompanyList_ItemDblClk(ByVal Part As SftBoxLib50.SftBoxPortionConstants, ByVal AreaType As SftBoxLib50.SftBoxAreaConstants, ByVal ItemIndex As Long, ByVal ColNum As Integer, ByVal Button As Integer, ByVal Shift As Integer)
    If AreaType = areaSftBoxColumnRes Then
        SftBox1.Column(ColNum).MakeOptimal 0
        SftBox1.Items.RecalcHorizontalExtent 0
    End If
End Sub

The application programmer 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 picture which always has the same width. By using Column.MakeOptimal to calculate the optimal width of the column, the column is wide enough to display all 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.


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