SftTree/OCX 7.5 Documentation

Display
Print

Width Property, SftTreeColumn Object

Defines the width of this column.

Syntax

Get

VB.NETW = object.Width As Single
VBW = object.Width As Single
C#.NETfloat W = object.Width;
VC++float W = object->Width;
float W = object->GetWidth();
CHRESULT object->get_Width(float* W);

Put

VB.NETobject.Width = W As Single
VBobject.Width = W As Single
C#.NETfloat object.Width = W;
VC++float object->Width = W;
void object->PutWidth(float W);
CHRESULT object->put_Width(float W);

object

A SftTreeColumn object.

W

Defines the width of this column. The units used depend on the container (Visual Basic, Visual C++, etc.) and the coordinate system used.

Comments

The Width property defines the width of this column.

The Width and Column.WidthPix properties are synonyms, but may use different coordinate systems.

The column width must be greater or equal to the column's minimum width. The minimum width can be defined using the Column.MinWidth property.

The last column in a tree control may be defined as an open-ended column (see ColumnsObj.OpenEnded). An open-ended column cannot be resized, because an open-ended column doesn't have a defined width. An open-ended column will always use the space remaining between the previous column and the right edge of the tree control window.

Due to the variable number of levels and the resulting hierarchical display, the width of the first column is always treated as a minimum width. The text portion of the first column will always be at least of the specified width, no matter what level the item is on. This can result in the first column being much wider than the defined width. To calculate the actual width of column 0, add the value returned by the ColumnsObj.OverheadWidth property to the value returned by Column(0).Width.

When changing column widths, the Items.RecalcHorizontalExtent method may have to be used to recalculate the optimal horizontal scrolling extent.

The Column.OptimalWidth or Column.MakeOptimal methods can be used to calculate or define the optimal width for a column. An optimal width allows all text and graphic components in a column to be displayed in their entirety, without being clipped.

Examples

VB6

Private Sub SftTree1_OLEDragDrop(Data As SftTreeLib75.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim insertAt As Integer
    Dim str As String
    Dim lvl As Integer, newItem As Integer
    Dim horzExtent As Single, col0Width As Single

    ' get horizontal extent and width of column 0
    horzExtent = SftTree1.Items.HorizontalExtent
    col0Width = SftTree1.Column(0).Width

    insertAt = SftTree1.Items.DropHighlight
    If insertAt < 0 Then Exit Sub

    If Data.GetFormat(vbCFText) Then
        lvl = SftTree1.Item(insertAt).Level
        str = Data.GetData(vbCFText)

See Also SftTreeColumn Object | Object Hierarchy


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