Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tree Control: NodeClick event

Status
Not open for further replies.

mpgalvin

Programmer
Feb 5, 2001
119
IE
When the user clicks on a tree node, the NodeClick event is launched, where I'm setting a public variable CurrNode to the .index of that node. I'm using this public variable in other places in the code.

Unfortunately, it only works if I explicitly click on a node, and this won't be the case when the form initially loads. What I want to do is simulate the effect of clicking on the first node of the tree, but, naturally, .nodeclick(1) doesn't work.

Is there anyway of "automatically" clicking on the first node at some point?
 
When you populate the tree control, you know what the first node is. Isn't it possible to set your public value there ?

Or maybe after populating the tree control you can access the nodes and marking your public variable.

Programmatically calling a click event is IMHO not a good way of programming...

HTH,
Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
Weedz, I totally agree with you, but at the time I couldn't think of a good way around my problem short of calling the event. On your suggestion, I initialised the public variable after populating the tree, and it appears to work fine.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top