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
Defines the index of the selected item (single selection tree control).
C
int WINAPI SftTree_GetCurSel(HWND hwndCtl); int WINAPI SftTree_SetCurSel(HWND hwndCtl, int index); int WINAPI SftTreeSplit_GetCurSel(HWND hwndCtl); int WINAPI SftTreeSplit_SetCurSel(HWND hwndCtl, int index);
C++
int CSftTree::GetCurSel() const; int CSftTree::SetCurSel(int index); int CSftTreeSplit::GetCurSel() const; int CSftTreeSplit::SetCurSel(int index);
hwndCtl
The window handle of the tree control.
index
The zero-based index of the item to be selected. This parameter may be -1 to deselect the currently selected item.
GetCurSel returns the zero-based index of the currently selected item in a single selection tree control. If no item is selected or if the tree control has the multiple selection attribute, the value -1 is returned.
SetCurSel returns the value 0 if the function was successful, otherwise -1 is returned.
The GetCurSel and SetCurSel functions define the index of the selected item (single selection tree control).
GetCurSel and SetCurSel can only be used with single selection tree controls. GetSel and SetSel are used with multi-selection tree controls.
GetCaretIndex can be used to retrieve the current item, i.e. the item that has the focus rectangle.
static void CopyPictureFromCurrentItem(HWND hwndTree) { SFTTREE_CELLINFOPARM CellInfo; LPSFTTREE_COLUMN_EX lpCol; int nCols; int w, h; int index = SftTree_GetCurSel(hwndTree); if (index < 0) return; // retrieve current cell picture CellInfo.version = 7; CellInfo.index = index; CellInfo.iCol = 0; SftTree_GetCellInfo(hwndTree, &CellInfo);
void CSampleView::CopyPictureFromCurrentItem() { SFTTREE_CELLINFOPARM CellInfo; LPSFTTREE_COLUMN_EX lpCol; int nCols; int w, h; int index = m_Tree.GetCurSel(); if (index < 0) return; // retrieve current cell picture CellInfo.version = 7; CellInfo.index = index; CellInfo.iCol = 0; m_Tree.GetCellInfo(&CellInfo);
See Also C/C++ API | Categories | Notifications