TreeView: BeforeCollapse

  • Thread starter Thread starter Patrick Dahmen
  • Start date Start date
P

Patrick Dahmen

Hello,

I enumerate database tables in my TreeView. Each table-node should show the
columns of the table. Since the Database might be huge, I don't want all
columns of each table to be listed, when I first initialize table.
So I use the BeforeCollapse EventHandler. Now I ask myself, that should ever
get called, if there is no + sign left of the node. (Because I until now I
did not add the ColumnNodes)
I hoped to find a Property of the TreeNode class, like
ShowPlusSignThoughIDontHaveChilds (=true) but I don't find it.
Sure I could add a dummy Node, but that does not seem to be nice code.

Does anyone has an idea?
Thank You
 
I'm actually writing a TreeNodeEx class [sub classing TreeNode] which can do
exactly what you're talking about

The treenode itself will generate the BeforeExpand event, and will can have
a more specific ContextMenu attached to the node itself

I posted some info about this last night, doesnt appear to be present for
some reason on the forum though :-/
 
The simplest way to do this is to insert a dummy node under the "empty" node
that you want to be able to expand later. When you get the "BeforeExpand"
event, check to see if the first child of the expanding node is the dummy
(look for a name, a Tag with a particular type, etc). If you find the dummy
node, you haven't filled in the children yet. Remove the dummy and fill in
the child nodes.

Jason Dorie
 
Is there a way for me to get my hands on that code? :)
I would like a TreeView that has ContextMenus on a per child basis.

at 2003-12-05 21:04, Eric Newton mumbled something like:
I'm actually writing a TreeNodeEx class [sub classing TreeNode] which can do
exactly what you're talking about

The treenode itself will generate the BeforeExpand event, and will can have
a more specific ContextMenu attached to the node itself

I posted some info about this last night, doesnt appear to be present for
some reason on the forum though :-/
 
Sure, I'm just doing some minor testing on it, but I dont have a good place
to host it

My current website hosting is "in contest", so I may write up an article
about it on CodeProject.com and then they can host it ;-)


--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
(e-mail address removed)-software.com [remove the first "CC."]

Glenn Nilsson said:
Is there a way for me to get my hands on that code? :)
I would like a TreeView that has ContextMenus on a per child basis.

at 2003-12-05 21:04, Eric Newton mumbled something like:
I'm actually writing a TreeNodeEx class [sub classing TreeNode] which can do
exactly what you're talking about

The treenode itself will generate the BeforeExpand event, and will can have
a more specific ContextMenu attached to the node itself

I posted some info about this last night, doesnt appear to be present for
some reason on the forum though :-/
 
Back
Top