Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Treeview trouble

Posted on 1999-07-25
34
Medium Priority
?
255 Views
Last Modified: 2010-04-04
hi all
um..how to make it so that when i click on the folder(icon) of a treeview item it expands completely?
i need it so that only the selected node expands completely (not all the treeview) but it cant fully expand if its a top node (the treeview is a directory listing and in my tests opening fully a top node(drive c for instance)can take ages and usually the program crashes :-(
for instance clicking on b1 would fully open the "b1 tree"

a
b b1
    b2
    b3
    b4
      b5
      b6
c
d
e

maybe i need a new desendant of this component...(this componnet is already a desendant of treeview with many extra stuff added to it)

B.T.W if your english ..hows the cricket? LoL
  and if your a aussie..hows the rugby ?  LoL

Regards Barry
 (double points and A for full source)
0
Comment
Question by:inthe
[X]
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
  • 18
  • 8
  • 4
  • +1
34 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1391052
hi barry,

the full source

procedure TForm1.TreeView1Click(Sender: TObject);
begin
  treeview1.Selected.Expand(True);
end;

meikl ;-)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391053
dammit meikl :) you so quick today :)))) didn't even had a chance to read the question and you've answered it.. hehe :))
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1391054
hi vik,

its just luck.
i look every one, two hours for new mail and new qs.

meikl ;-)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Author Comment

by:inthe
ID: 1391055
hi,
cheers but i knew that one and its a bit more complicated than that ;-)
if you open the customdraw demo in delphi
directory and run it, what im after is when
 clicking on any of the top level nodes ie
"nebulae" or
"clusters" or
"galaxies" or
"others"
the treview opens normally as windows explorer does.
BUT when clicking on any of the child nodes it expands the node  like  treeview1.Selected.Expand(True) does.
do you know what i mean now?
Regards Barry

0
 
LVL 17

Author Comment

by:inthe
ID: 1391056
this might help explain better:
my treeview is a dirtree.the nodes are the same as explorers nodes.i want for instance to be able to click on "program files" node and that node expands fully(the same as the code you gave in answer) but if i click on c drive (top level node) or d drive(another top level node) the node opens normally .
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391057
simply check if the directory that you click on is the root to a different drive and if it's not use the above code to expand the nodes....
0
 
LVL 17

Author Comment

by:inthe
ID: 1391058
first to give code gets points :-)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391059
What component are you actually using?? Dirtree? I can't seem to fine such component...!?!?
0
 
LVL 17

Author Comment

by:inthe
ID: 1391060
dunno where i found it so i have have sent you a copy of it.


0
 
LVL 17

Author Comment

by:inthe
ID: 1391061
ah..found download address for anyone else who's interested:

http://home.t-online.de/home/merkes/dirtree.zip
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391062
ok, I got it.. still not sure what you mean?!?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391063
When I double click on any of the roots it simply expands as far as it can, but it keeps the previously oepend nodes, so if you had opened all of the nodes before, it will expand till, therem if you haven't then it will simple expand one column or whatever.....

please explain the exact behaviour it's doing now and what you wanna get out of it...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391064
damn man,,, i see what you mean :)) it took the dirtree about an hour to expand the c root :))
0
 
LVL 10

Accepted Solution

by:
viktornet earned 1000 total points
ID: 1391065
There you have it :)

procedure TForm1.DirTree1DblClick(Sender: TObject);
begin
     if DirTree1.Selected.Level <> 0 then
        DirTree1.Selected.Expand(true);
end;

..-=ViKtOr=-..
0
 
LVL 17

Author Comment

by:inthe
ID: 1391066
ok just a quick test to check though i believe you got it.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391067
np
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1391068
I guess this is more like it, right?

procedure TForm1.DirTree1DblClick(Sender: TObject);
begin
  DirTree1.Selected.Expand(DirTree1.Selected.Level <> 0);
end;

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391069
I guess this is more like it, right?

procedure TForm1.DirTree1DblClick(Sender: TObject);
begin
with DirTree1.Selected do Expand(Level<>0);
end;

or even this...

procedure TForm1.DirTree1DblClick(Sender: TObject);
begin
with DirTree1.Selected do Expand(bool(Level));
end;

Well, Did you get it to work Barry?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391070
opps, forgot....

..-=fOoL=-..
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391071
Barry, is something not working as you want it? What is it?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391072
Dammit.... Look at this...

             Last 10 Grades Received
             C A A A A A A A A A

Another guy just accepted an answer of mine and gave me a C :(
0
 
LVL 17

Author Comment

by:inthe
ID: 1391073
sorry was a while im having some pc problems please see my new q when i ask it in a minute.

perfect answer viktor much appreciated :-)


whats this though :  ..-=fOoL=-..    ?




0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1391074
Grow up Viktor
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391075
ohh, you mean... ..-=fOoL=-.. ?? I dunno, ask Elypson, he probably knows?!?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391076
I meant to say Epsylon... sorry...

Epsylon, I consider myself grown up ENOUGH to understand what is right and wrong... THe the comment abount acting foolish wasn't needed at all... you said that I was annoying you because I was fast, and answered that TMemoryStream question right away... Why do you think I'm here? To just stand around and watch you help people I wanna help people too.. dont you think that is a good idea?

btw, I apologize for any conflicts, but I think you should act a little more mature too...

..-=ViKtOr=-..
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391077
Barry, I don't see any questions yet?!
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1391078
Viktor, it was not the answer you gave, but the way you lock questions. What does some person who buys that Stream question see?


------------------------------------------------------------
Accepted Answer:
------------------------------------------------------------
OK MAN.... HOLD ON A SECOND.... and PLEASE stop reject.. i will give you the code in a second... you're not the only one whose answers i answer., okay? have some patience... i'll give you the code in a few minutes...
------------------------------------------------------------


But let's forget about it, ok?

Epsylon.
0
 
LVL 17

Author Comment

by:inthe
ID: 1391079
enough arguing please all we get on to well to be arguing about stupid points and stuff.
although one prick gave me a c yesterday for a perfect answer and the only possible answer to the question.
remember the q about the keyboard and mouse viktor?
and i gave the asm way for the keyboard and a hook way for the mouse and said could use showcursor()well he said he wanted no dlls and wanted asm way also for the mouse then
accepted the answer on a c!!!
then the bloke who deleted the question we commented in and said thanks you both helped me ,the question about the outlook98 stuff.
we ought to stick together against unpolite questioners etc not be fighting "in house".
 
anyway nuff said here's 1000 points and now my new q is asked please help if you can its p***ing me off ,rebooting all the time
Cheer Barry
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391080
Epsylon, I apologize.. You're completely right (btw, if someone buys that stream question he would find the answer down the road..anyways)...

Barry, thanks for the points, and Epsylon, I apologize once again.. I think we should really stick together instead of arguing and stuff...


..-=fOoL=-..













just joking :)

btw, don' you think that would be a nice signiture for me? FOOL? :)

..-=ViKtOr=-..
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1391081
..-=ViKtOr=-..  is just fine   :o)

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391082
I see :)

okay, let it be ..-=ViKtOr=-.. then #;o)

..-=ViKtOr=-..
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1391083
much happened during my sleeping time ;-)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391084
it sure did ;-))
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1391085
;-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

730 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