How do I get the node (index or text) from a Treeview node when the user
clicks on the item? OnChange fires whenever the tree is changed, like when
its created.
Thanks
Excuse for my english.
Andrea
Jay Jackson <jjac...@ndcorp.net> wrote in message
8ls9fl$7v...@bornews.borland.com...
Andrea Petrelli <petrell...@ctech.it> wrote in message
news:3981ae45_2@dnews...
Jay Jackson <jjac...@ndcorp.net> wrote in message
8lsatf$7v...@bornews.borland.com...
Jay Jackson <jjac...@ndcorp.net> wrote in message
news:8ls9fl$7v...@bornews.borland.com...
MrBaseball34 <mrbase...@hotmail.com> wrote in message
8lsbn8$7v...@bornews.borland.com...
if treent1.selected = 1 then // not valid
if treent1.selectedindex = 1 then // not valid
if treent1.selected.SelectedIndex = 1 then // valid, but returns index of
imagelist - not selected item.
This works
if treent1.selected.text = 'Item One'
but I would rather get the index number so I can use a case statement.
PS. MrBaseball - in the time it took you to write that silly response, you
could of simply answered the question with specific code. At least if your
gonna be a smart-ass - post an accurate response.
procedure TForm1.TreeView1Changing(Sender: TObject; Node: TTreeNode;
var AllowChange: Boolean);
begin
ShowMessage(IntToStr(Node.AbsoluteIndex));
end;
OR
procedure TForm1.TreeView1Change(Sender: TObject; Node: TTreeNode);
begin
ShowMessage(IntToStr(Node.AbsoluteIndex));
end;
I'd suggest you install the help files, anyway...
>How do I get the node (index or text) from a Treeview node when the user
>clicks on the item? OnChange fires whenever the tree is changed, like when
>its created.
.... or when the user clicks on a different node! Use that OnChange
event and check the Node parameter being passed into it.
Otherwise, the TTreeView.Selected returns the TTreeNode that's
currently selected. Use it's Index (for position relative to parent),
AbsoluteIndex (position in tree) or Text properties. (for the text
you're looking for)
------------------------------------------------------------------------
Marc Scheuner Software Engineer
FastLane Technologies Inc. Halifax, Nova Scotia, Canada
Email: mailto:msch...@fastlane.com
Plan, Deploy, Manage Windows 2000 with FastLane DM/Suite.
Optimize Windows 2000 now!
http://www.fastlane.com