Home > Back-end >  Delphi treeview node
Delphi treeview node

Time:10-04

A
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 one

CodePudding 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 node
Click 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
reference 3 floor response:
each node is not the only tags? Can keep the tag in the data attribute of node
Click you can distinguish
the treeview is translating into the menu menu, double-click to open the treeview nothing empty, only the runtime can see

CodePudding user response:

refer to the second floor 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,

, write what, if anything, can put ImageIndex attributes in a specified value, judging by the node ImageIndex call which window,
how can put ImageIndex attributes of a specified value, I the treeview is translating into the menu menu, double-click to open the treeview nothing is empty, only the runtime can see, don't like direct double-click the treeview add one node in can also set the index

CodePudding user response:

The
reference 4 floor response:
Delphi (Pascal) code

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;
seem to have A problem, when there is more than A, B two root nodes, child nodes, child nodes are many cases like it won't work, don't there another way

CodePudding user response:

Similar?

CodePudding user response:

Aa1

If tv1. Selected=tv1. Items [0]. Item [0]. Item [0] then * * *.
  • Related