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
Expands a parent item.
C
BOOL WINAPI SftTree_Expand(HWND hwndCtl, int index, BOOL fPreserve, BOOL fDepth); BOOL WINAPI SftTreeSplit_Expand(HWND hwndCtl, int index, BOOL fPreserve, BOOL fDepth);
C++
BOOL CSftTree::Expand(int index, BOOL fPreserve = TRUE, BOOL fDepth = FALSE); BOOL CSftTreeSplit::Expand(int index, BOOL fPreserve = TRUE, BOOL fDepth = FALSE);
hwndCtl
The window handle of the tree control.
index
The zero-based index of the item to be expanded. If -1 is specified, all items on level 0 are expanded.
fPreserve
Set to TRUE to restore the expand/collapse state of dependent items made visible, as saved by a previous call to Collapse. If FALSE is specified, only the item defined by index is expanded and immediate dependents are made visible but remain collapsed.
fDepth
Set to TRUE to expand all dependent items, including non-immediate dependent items. If TRUE is specified, fPreserve is ignored as all dependents are expanded.
The return value is TRUE if successful, otherwise FALSE is returned.
The Expand function expands a parent item.
Expand expands all dependent items of item index and restores the expand/collapse state of all dependent items, as saved by a previous call to Collapse.
If an item is already expanded when using Expand, the item remains unchanged. It does not make any indirect dependents visible. To make sure that an item's indirect dependents are shown, use Collapse first, which collapses the item (and all dependents), followed by Expand. Now all dependents are visible.
In a tree control using a virtual data source, this function cannot be used and an error is returned.
index = SftTree_GetExpandCollapseIndex(hwndCtl);/* Get caret location */ /* Check if item is expanded */ fExpand = SftTree_GetItemExpand(hwndCtl, index); /* If the CONTROL key is pressed, expand all dependent levels */ fControl = (BOOL)(GetKeyState(VK_CONTROL)&0x8000); if (fExpand) SftTree_Collapse(hwndCtl, index, TRUE); else SftTree_Expand(hwndCtl, index, TRUE, fControl); break; } case SFTTREEN_EXPANDALL: { // expand all int index; index = SftTree_GetExpandCollapseIndex(hwndCtl);/* Get item to expand/collapse */ SftTree_Expand(hwndCtl, index, TRUE, TRUE); break;
/* get current expand/collapsed status */ BOOL fExpanded = m_Tree.GetItemExpand(index); /* if control key is used we'll expand all dependents */ BOOL fDepth = (::GetKeyState(VK_CONTROL)&0x8000); if (fExpanded) m_Tree.Collapse(index, TRUE); else m_Tree.Expand(index, TRUE, fDepth); } /* Respond to numeric keypad multiply key. */ void CSampleView::OnExpandAll() { /* get index of item to expand/collapse */
See Also C/C++ API | Categories | Notifications