Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

treeview node selection

Posted on 2001-07-07
5
154 Views
Last Modified: 2010-04-06
my question is how can i select the last parent node entered without selecting a childnode?
0
Comment
Question by:moggy12
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
nnbbb09 earned 50 total points
ID: 6262166
Hello,

Try this. It works by starting with the last node in the treeview and working its way back to the first one. As soon as it find's a node with no parent it selects it and breaks out of the loop.

procedure TForm1.Button1Click(Sender: TObject);
var
  i:integer;
begin
  for i:=treeview1.items.count -1 downto 0 do
  begin
    if treeview1.items[i].parent=nil then
    begin
      treeview1.items[i].Selected:=true;
      break;
    end;

  end;
end;

Jo
0
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6263756
I see you didnt accept nnbbb09 comment therfore I have a question:

as you see nnbbb09 comment finds the Last root ( or node without parent ) made in the treeview and I Think this  comment is acceptable.therefor maybe we dont understand your exact question. now what is your main question?
0
 

Author Comment

by:moggy12
ID: 6263991
Thanks nnbbb09, you answer gave me what i was looking for.

mohsenian, i was busy elsewhere and i think it rude of you that you assume that if someone does not respond back promptly they have rejected the answer.    
0
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6264222
hi moggy12,

sorry, you are right but I think 'rude' is not a good word for my action.
0
 

Author Comment

by:moggy12
ID: 6269483
what word would you use then..."arrogant",
"obnoxious"...or do you have one in mind?

I hope you will give others a little more time before jumping on them.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 161
Using idhttp to login to instagram 2 106
Process Javascript errors with Delphi TWebBrowser 1 174
select query - oracle 16 100
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question