A
1
1
2
2
B
B
A
1
2
B
May show A bit of A problem, it is under A root node with A, b two child nodes, and 1, 2, under A two child nodes; B under the root node has a, B two child nodes, and 1, 2, under a two child node
Procedure TForm1. TreeView1Click (Sender: TObject);
The begin
If (treeview1. Selected. Level=2) and (treeview1. Selected. The Index=0) then
Methodsfrm. Show;
end;
1. Click when running A - A - 1 when open the window, click the B - A - 1 also opened the window, how to solve, the goal is to click on B - A - 1 to open the window,
Root node level 0, the child nodes of the root node is 1 grade, so on. Serial number (index) to 0 (under the same level as the node according to the number from the top to the bottom of the first to 0, the second is 1, and so on,
This all know, just don't know how to distinguish between multiple root nodes under the condition of
2. If you want to click A - A - 1-1 and how to write?
CodePudding user response:
His first oneCodePudding user response:
The building Lord if we know that this code is very trouble, why not change,Such as: Aa1 Aa11; Ab1 Ab11;
So know is that as soon as you see,
To write what, if anything, can put ImageIndex attributes in a specified value, judging by the node ImageIndex calls which window,
CodePudding user response:
Each node is not the only tags? Can keep the tag in the data attribute of nodeClick on the can distinguish
CodePudding user response:
if not ((treeview1. Selected. Level=2) and (treeview1. Selected. The Index=0)) then
exit;
If (treeview1. Selected. The parent. The text='A') then
Methodsfrm. Show;
CodePudding user response:
The