SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
The caret location changes.
VB.NET | Private Sub object_CaretChange(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.CaretChange |
VB | Private Sub object_CaretChange(ByVal ItemIndex As Long) |
C#.NET | void object_CaretChange(object sender, EventArgumentType e); |
VC++ | void OnCaretChangeobject(long ItemIndex); |
C | HRESULT OnCaretChangeobject(long ItemIndex); |
object
ItemIndex
The new zero-based index of the current item.
The CaretChange event occurs when the caret location changes.
The current item is the item that has the caret rectangle, which is a rectangle outlining the border of the current item (see Items.Current). When using the up and down arrow keys, the user changes the current item (or caret location, also see Items.NoSelection). The current item is not necessarily the same as the selected item. The Item.Selected property can be used to change the selected item.
ItemIndex may be 0, even if the tree control is empty.
The current item can also be affected by the Items.DropHighlightStyle property.
m_DeletedFolder = AddFolder("Deleted", "Deleted messages", 0) AxSftTree1.ColumnsObj.MakeOptimal() AxSftTree1.Items.RecalcHorizontalExtent() AxSftTree1.Splitter.MakeOptimal() ' allow sorting AxSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto AxSftTree1.Items.Current = 0 AxSftTree1_CaretChange(Me, New _DSftTreeEvents_CaretChangeEvent(0)) End Sub Private Sub AxSftTree1_CaretChange(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_CaretChangeEvent) Handles AxSftTree1.CaretChange ' set column headers based on selected item Dim ID As Integer ID = AxSftTree1.get_Item(e.itemIndex).ID If ID = m_InboxFolder Or ID = m_OutboxFolder Or ID = m_SavedFolder Or ID = m_DeletedFolder Then
DeletedFolder = AddFolder("Deleted", "Deleted messages", 0) .ColumnsObj.MakeOptimal .Items.RecalcHorizontalExtent .Splitter.MakeOptimal ' allow sorting .Headers.SortIndicators = headerSortIndicatorsSftTreeAuto .Items.Current = 0 SftTree1_CaretChange 0 ' to update column headers End With End Sub Private Sub SftTree1_CaretChange(ByVal ItemIndex As Long) With SftTree1 ' set column headers based on selected item Select Case .Item(ItemIndex).ID
m_DeletedFolder = AddFolder("Deleted", "Deleted messages", 0); axSftTree1.ColumnsObj.MakeOptimal(); axSftTree1.Items.RecalcHorizontalExtent(); axSftTree1.Splitter.MakeOptimal(); // allow sorting axSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto; axSftTree1.Items.Current = 0; axSftTree1_CaretChange(this, new _DSftTreeEvents_CaretChangeEvent(0)); } private int AddFolder(string Folder, string Desc, int Count) { int ItemIndex = axSftTree1.Items.Add(Folder); // add folder axSftTree1.get_Cell(ItemIndex, 1).Text = Desc; // add description axSftTree1.get_Cell(ItemIndex, 3).Text = Count.ToString(); // add number of messages
m_DeletedFolder = AddFolder(_T("Deleted"), _T("Deleted messages"), 0); m_vTree->ColumnsObj->MakeOptimal(); m_vTree->Items->RecalcHorizontalExtent(); m_vTree->Splitter->MakeOptimal(); // allow sorting m_vTree->Headers->SortIndicators = headerSortIndicatorsSftTreeAuto; m_vTree->Items->Current = 0; OnCaretChangeSftTree1(0); // to update column headers return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework.
See Also SftTree Object | Object Hierarchy