Board index » cppbuilder » Right Click TTreeView Node and Suppress Expansion?

Right Click TTreeView Node and Suppress Expansion?


2003-12-11 07:40:43 AM
cppbuilder101
Using BCB v6 sp4 on Win2k.
I want a user to be able to right click on a treeview TTreeNode, select it, and bring
up a context menu on it. Doing that causes that node to expand to show its children.
My lousy work-around in the MouseDown event is to do:
TTreeNode* NodePtr = DataSetTreeView->GetNodeAt(X, Y);
bool IsExpandedFlag = NodePtr->Expanded;
NodePtr->Selected = true; // causes the node to expand.
NodePtr->Expanded = IsExpandedFlag;
Setting it Selected causes it to expand and there is a brief flash of that happening.
But I imediately compress it back down if it was not expanded in the first place.
Is there some way to select a node and not have it expand on you?
 
 

Re:Right Click TTreeView Node and Suppress Expansion?

"Randall Parker" < XXXX@XXXXX.COM >wrote in
message news:3fd7af0c$ XXXX@XXXXX.COM ...
Quote
My lousy work-around in the MouseDown event is to do:
Have a look at the OnExpanding event instead. You can block expansions from
there.
Gambit