TCustomShellTreeView.CanExpand function
Determines if the specified tree node can be expanded in the shell tree view control.
Declaration
function CanExpand(Node: TTreeNode): Boolean; overrideArguments
Node | Tree node examined in the method. |
Function result
True when the tree node can be expanded to display child nodes.Description
CanExpand is an overridden
Boolean function used to
determine if the specified tree node can be expanded in the shell tree view
control. CanExpand ensures that the shell control reflects the current content
in the local file system during execution of the method.
Node contains the
TTreeNode examined and updated in the
method.
CanExpand calls the inherited method to signal the OnExpanding event handler (when assigned). No additional actions are performed if the inherited method returns False.
CanExpand temporarily disables the
AutoExpand
functionality in the shell tree view control, and updates the child nodes in
Node when needed. The value in ExpandCollapseMode is used to determine whether
child nodes are created or recreated. The following actions are performed for
the ExpandCollapseMode property values:
- ecmRefreshedExpanding
- Deletes existing child nodes and calls PopulateTreeNodeWithFiles to reload entries for the path in Node.
- ecmKeepChildren
- Keeps existing child nodes. Calls PopulateTreeNodeWithFiles if the existing child node count is 0 (zero).
- ecmCollapseAndClear
- Calls PopulateTreeNodeWithFiles to load files for the path in Node.
The value in AutoExpand is restored to its original value prior to
exiting from the method.
The entire update process is done in a BeginUpdate / EndUpdate block to reduce the number of screen refreshes in the method.
Modified in LCL version 3.0 to use ExpandCollapseMode to control actions performed for child nodes.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
