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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Tree View 2

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
So after a few have suggested that for one of my more complex relationships that a Tree View might be an easier form of navigation, I decided to give it a try.

But wow... this is one of the more daunting controls, and I remember now why I always avoided it in the past. I've read through a lot of the site posts, many of which have links to articles that no longer exist... (pity that wasn't thought ahead and had some of the core bits brought into the post instead of linked outside the site). Of the few I found, they still seemed to be so different in their example, and compared to the example in the SAMPLES section of VFP, I still don't "get it".

In particular, I see in code references to a "node" property, but the ActiveX control I see only "NodeChec" and "NodeClick" methods, and no other properties related to node. So I don't understand how to write these.

One example creates a "procedure" called PopulateTreeView, I'm not sure if that's the same as a "Refresh" clause on the Treeview control, or is it better to add this method?

I suppose in general what I'm looking for out of all this data is, what's the best way to approach this class? Great that they created this very powerful "base class" but it's so sparse in it's otherwise implementation.

I think maybe it's best to describe as well, what I envision is having a "Root" node that is populated from one table, and then the child records for the root nodes added to the table. (There are grand-child and great-grandchild, but I suspect if I can get Parent (root) and child then the rest should be just cascading that.)

Appreciate your help on guiding me through this, I've never used this class before.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
So I was about to go into a long question about how to add "groupings" to the tree and why I couldn't get to a level deeper than 2, and in writing it all up, I figured it out. :)

So that's the good news.
But, I tried to do a bit with it now that I've got some things in my tree to actually look at and click on. I put the:
LPARAMETERS Node
MESSAGEBOX("You clicked on " + Node.Text)

But when I click it I get an error stating NODE is not an object.

Not sure why that's not working?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Notice: You yourself and Mike talked about NodeClick Event. If you entered the event code editor and there wasn't already the LPARAMETERS line you prgrammed that into the normal Click? You can't force parameters to come into an event, you have to take what's there.

And in case you really talk about the NodeClick event you would have a rare special case the Node parameter would not be a node. If so, check it with VARTYPE(), but I think you just got the wrong click event.

Bye, Olaf.


 
Hi Olaf,
Ah... feeling stupid now, as I read that as "Node Click Event" instead of "NodeClick Event". I realize how stupid that was now, and the TreeView Click Event is where I had it. It didn't occur to me there was a separate event, and I just didn't see it. That's working now, thanks.

I was just thinking though, looking at the tree view's behavior, and how easy it is to build selection items in it, it would be the perfect replacement for a "trick" of making a mousewheel scrollable "combobox", like we discussed previously. Maybe I start a new thread for this because it could be very cleaver way to enhance UI control.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top