Important alert: (current site time 7/16/2013 3:10:41 AM EDT)
 

winzip icon

cTREEVIEW Class Wrapper (RELEASE 3) with ADO Code Example

Email
Submitted on: 9/20/2001 4:52:08 AM
By: Slider 
Level: Intermediate
User Rating: By 73 Users
Compatibility: VB 6.0
Views: 42454
 
     ** Release 3 ** New cTREEVIEW features: Flat border; IsChildNode; CopyNode with cancel option; Cut Icon state. ADO example supporting: Load on demand; Find First/ Next/ Previous; Label Edit; Drag'n'Drop; Node & TreeView context menus; node specific Open/Closed/Drag icons. ADO Example now supports: New Nodes/Records can be added; copy treeview node(s); Cut/Copy/Paste through right-click context menu; and functions are now benchmarked with results displayed. ** Release 2 ** cTREEVIEW class features: Scroll treeview Up/ Down/ PageUp/ PageDown/ Home/ End using code; Dragging with auto-scrolling (not supported by Microsoft in the TreeView control); NodeFirstViewable; & NodeLastViewable. ADO Example fixes: Find Next/Previous didn't work if branches already loaded. cTREEVIEW class fixes: correct node drag icon displayed. cTreeview features include: fast clear a treeview; extended Add/Rename/Delete nodes; copy & move nodes through code &/or Drag'n'Drop including parent nodes onto child nodes (not normally possible!); find node using text and (optionally) key properties; check if a node is a parent of another; checks if a node is a root node; a safe get parent node text; right-click context menu (before/after click event); collapse/expand all nodes; collape/expand all child nodes; enable/disable redraw. This example shows how to:- work with multiple tables of data and load data on demand. As a bonus, I've included cDB class that encapsulates working with an Access Database using ADO. All code is heavily commented. If there are any routines that you feel are missing or code/bug-fixes that you wish to contribute, then please let me know and I'll add them in. *** Latest version can be found here:- http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=37553&lngWId=1 ***

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 18 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
9/20/2001 6:45:54 AMLawman

Mate - this just blew my socks off! Keep up the fantastic work! 5 Globes from me!!!
(If this comment was disrespectful, please report it.)

 
9/20/2001 10:57:56 AMaaron

very nice :D 5 globes for great work

(If this comment was disrespectful, please report it.)

 
9/20/2001 5:04:22 PMReggie

Hey slider this is a really great thing you got going on here. I just downloaded the previous version about a week ago and thought it was the greatest thing since slice bread and then saw this one and thought... he's good. Keep up the good work. This has helped me out alot.

One request for your next version. Could you put to use a pop up menu only inside of treeview window. Thanks!!!
(If this comment was disrespectful, please report it.)

 
9/20/2001 5:55:04 PMSlider

Lawman, Aaron, reggie thanks for the votes!
(If this comment was disrespectful, please report it.)

 
9/20/2001 6:02:03 PMSlider

Reggie, the ContextMenu event is where you put your code for the popup menu. The ContextMenu event was also designed to tell you which note was right-clicked. I guess that I was lazy and didn't put it into the example. I'll add it and icons to the example.
(If this comment was disrespectful, please report it.)

 
9/20/2001 6:21:05 PMHot Head

Hey reggie, I agree with you. I've always struggled with the Treeview control and found it hard to do much with it. I'm now going to use this class with the control in all of my applications. Thanks Slider & keep up coding man! I can't wait to see what's coming next....
(If this comment was disrespectful, please report it.)

 
9/20/2001 11:21:57 PMZhu JinYong

Excellant!I have downloaded all program of your submissions.I saw much improvements you have made.
Suggention:could you add image for every node? and,May it be better to support Right Click and pop up a menu to set up all properties of this control.
Thank for your great job!
Email:zhujy@samling.com.my
(If this comment was disrespectful, please report it.)

 
9/21/2001 2:08:46 AMSlider

Zhu,

Thanks for your support. (Icon) Image support is already there standard with the control. As I've implemented right click event called ContextMenu(Node, X, Y,) - it will advise which node was right clicked. What I'm doing is updating the example to include right click popup menus (Node vs control) + icons (Expanded, collapsed, drag, etc...), cTreeView class to support background image.
(If this comment was disrespectful, please report it.)

 
9/21/2001 3:54:22 AMZhu JinYong

Thanks for so fast reply.For your information,there are some bugs when moving Node.Pls correct it.
You,always do good job.
(If this comment was disrespectful, please report it.)

 
9/21/2001 8:34:00 AMslider

Zhu, more info pls
(If this comment was disrespectful, please report it.)

 
9/22/2001 5:11:35 AMmichael

Hello Slider,
>
what can I say, a fantastic work.
5 stars from me.
>
regards
michael doering
(If this comment was disrespectful, please report it.)

 
9/26/2001 3:11:11 AMHari

Boy! this is wonderful. I am actually working on something like this and found your code and this makes it easier. Keep up the good work. Defn 5 globes

:-)
(If this comment was disrespectful, please report it.)

 
9/29/2001 12:03:14 AMHans

Great work! 5 stars from me!
(If this comment was disrespectful, please report it.)

 
10/14/2001 2:47:21 PMThanawut Naonan

This is the GREATTEST work I've ever seen on PSC!!!!!
5 BIG GLOBES FOR YOU!!!

Keep up your good work!!

:-)
(If this comment was disrespectful, please report it.)

 
11/26/2001 3:00:13 PMCarp@verdictsystems.com

Slider -

This is a very comprehensive treeview helper!

Two questions for you -

One - if the tree contains a very large number of nodes (say you're loading from a database), then using the Key property when you add nodes slows it down incredibly. I've been trying to find a solution for this forever, and I know it can be done since various third party controls provide database binding to a tree that loads very quickly.

Second - I've posted this to a few user groups with no luck - is it possible to create a "mask" for the icon to change depending on some external condition other than whether the item was selected/de-selected. For example if the tree is created from a database and you want the icon to change based on a certain entry, rather than creating a separate icon for the node, is is possible to just add an overlay (kind of like a windows shortcut curvey arrow) to the existing icon?

Great code!

Carp


(If this comment was disrespectful, please report it.)

 
12/3/2001 11:23:03 AMBruce

GREAT CODE!

When running your demo, I'm having trouble moving a node within the control by dragging it. It appears that the Dragging and Dropped events of the control are never fired. Any ideas on how to fix this?
Thanks in advance!
(If this comment was disrespectful, please report it.)

 
12/3/2001 11:02:33 PMSlider (Author)

Bruce,

I'm not experiencing your problem. Do you have VB Service Pack 5 installed?
(If this comment was disrespectful, please report it.)

 
1/14/2002 7:41:13 AMCoite

Well already voted on the original, so will have to give you another 5 Globes in comment format. Real glad to see you are improving this, nice work, nice code, and Thanks!
(If this comment was disrespectful, please report it.)

 
1/14/2002 8:50:49 AMDaniel

Great stuff! Thanks!
(If this comment was disrespectful, please report it.)

 
1/14/2002 9:52:08 AMJohn Couture

Great code. Well written and commented. It's nice to see real professional code. This example will definitely make me check out your other submissions.
(If this comment was disrespectful, please report it.)

 
1/14/2002 8:41:06 PMalfonso

This is a great code you deserve 5 globes from me Keep the good work
(If this comment was disrespectful, please report it.)

 
1/16/2002 12:48:06 AMZhu JinYong

Hi Slider,Still remember the minor bugs when fast double clicking node to expand or collapse,error "Unable to move selected node" occurs.Just put "Sleep 100" after---If Not (.HitTest(X, Y) Is Nothing) Then---in oTree_MouseMove routine to force the program stop 100ms.Maybe have a better way to do.
Email to :zhujy@samling.com.my
(If this comment was disrespectful, please report it.)

 
1/16/2002 6:10:50 AMSlider

Zhu, Thanks for the suggestion. A new version will be posted shortly and I'll have a work-around included.
(If this comment was disrespectful, please report it.)

 
1/17/2002 12:34:25 AMImran Iqbal

This type of work is appreciatable.You have done very good.
(If this comment was disrespectful, please report it.)

 
1/17/2002 6:19:28 AMenjoy

This is one of the Great Work I've Seen in PSC!!!
(If this comment was disrespectful, please report it.)

 
1/17/2002 8:47:38 PMZhu JinYong

Add a Timer(ccrpTimer)to auto expand Parent Nodes while dragging node to drop to another Node.I think you can do it or contact me:zhujy@samling.com.my
(If this comment was disrespectful, please report it.)

 
3/22/2002 4:07:52 PMDougW

This absolutely saved me at LEAST a month of busting my brain. Very Comprehensive work! Excellent examples! Thanks!
(If this comment was disrespectful, please report it.)

 
5/4/2002 7:09:36 PMSlider

new version (v02.01.00) can be found at
(If this comment was disrespectful, please report it.)

 
5/27/2002 11:29:08 PMDane

Slider, this is awesome. 5 Globes. I have 2 points: When the Node is expanded the Icon is not correct until a SubNode is selected.

When in Drag Mode - Pressing 'Esc' (27) should end the drag action. Again Great Code.
(If this comment was disrespectful, please report it.)

 
6/7/2002 10:03:48 AMRob

Excellent Code, extremely well written, v. v. good
(If this comment was disrespectful, please report it.)

 
6/20/2002 5:37:44 AMMichel

Nice program I use it partially in my remake of regEdit tools.
So I think that I have identify a trouble into the utilization of collapseAll Sub.
I you use CollapseAll sub After the standard collapse expand by clicking on the + or - doesn't work!

To test that add a command button to your Form and CollapseAll into the command_click Sub.
Ready to do more tests.

One more time thanks you
Michel


(If this comment was disrespectful, please report it.)

 
7/19/2002 5:10:33 PMMike

Not bad man, now if you could just encompass all of that functionality into one control you would have the best treeview control.

-Mike
(If this comment was disrespectful, please report it.)

 
7/19/2002 11:35:41 PMSlider

Dane, Thanks for the comments, will look into it. Rob, thanks for the feedback! Michael, code fixed & will be release within the next few days (code sent via email already). Mike, Thanks for the feedback - it's already in the planning stages.
(If this comment was disrespectful, please report it.)

 
8/1/2002 1:39:24 PMAndrew

can you add functionality to save and load a treeview into/from a file?
(If this comment was disrespectful, please report it.)

 
8/1/2002 11:02:56 PMSlider

Andrew,

Already done back in April. To get the latest version goto:- http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=34439&lngWId=1

I'm
currently trying to upload release 5 but having great difficulty with the site timing out - keep your eyes peeled - it'll be up any sec now....
(If this comment was disrespectful, please report it.)

 
8/4/2002 2:25:16 AMSlider

** *** Latest version can be found here:- http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=37553&lngWId=1 *** **
(If this comment was disrespectful, please report it.)

 
10/26/2002 3:26:16 AMAmer Khreim

can you help me Slider
i need your help please
(If this comment was disrespectful, please report it.)

 
10/29/2002 5:37:17 AMSlider

How can I help?
(If this comment was disrespectful, please report it.)

 
11/11/2002 4:45:31 AM

Thanks heaps Slider. Have another five globes!
(If this comment was disrespectful, please report it.)

 
2/17/2003 4:25:00 PMJaySonic

Great code slider. Can you suggest a good way to keep track of the order of the nodes? If you move products around within the same group, they will just re-arrange back when you reload. Seems the order in which they were added is as far as it goes. Any insight to this?
(If this comment was disrespectful, please report it.)

 
2/18/2003 6:41:46 AMSlider

JaySonic, You've found an old version of cTreeView. I'd suggest grabbing the latest and you the Load/Save and that'll fix your problem!

Slider
(If this comment was disrespectful, please report it.)

 
2/18/2003 10:34:56 AMJaySonic

Thanks for reply Slider. I have downloaded the version 2.03 and tried it with no success. What I was refering to was in regards of the ADO refrence to the treeview. By reload, I meant closing the application and starting back up again. I figure I must need to apply and orderID number to each product within a group, and then update ID when it moves areound in the group. It is the only way I can see of keeping the oder of the nodes. Does that make sense or have I totaly lost myself?
(If this comment was disrespectful, please report it.)

 
2/18/2003 11:32:34 AMJaySonic

One other thing I have noticed Slider, is that the Left and Right VB functions no longer work once a refrence to the cTreeView Wrapper Class is made......Further investigation into the problem using the NODLL vbp has revealed the source of the problem is in the cTreeView.cls file.

I hope you dont think I am being picky. This is still one of the best submissions I have seen!!!

Thanks
(If this comment was disrespectful, please report it.)

 
2/18/2003 11:59:18 AMJaySonic

The problem in not being able to use the Right and Left functions has to due with the declarations in the cTreeView.cls file at the
Public Enum eCodeScrollView
location. Abbreviating the [Left] and [Right] to something like [LT] and [RT], then replacing those instances througout the code will solve the problem. Sorry for all the posts, just trying to add value.
(If this comment was disrespectful, please report it.)

 
2/18/2003 3:07:35 PMJaySonic

Pardon me Slider, I found where you are able to load and save. Thanks
(If this comment was disrespectful, please report it.)

 
2/18/2003 6:03:47 PMJaySonic

Hey Slider, I am trying to debug the save/load ability because it doesnt seem to be saving/loading the order correctly. Anyway, I am fairly new to programming dll's and was wonder if you could enlighten me on you debug the classes. Every time I try to do it my computer locks the application up at the break. Any insight on this would be very helpful!

Thanks
(If this comment was disrespectful, please report it.)

 
3/3/2003 9:56:02 AMJaySonic

Thanks anyway
(If this comment was disrespectful, please report it.)

 
4/28/2003 9:46:10 PM

2 words......... holy sh%$
(If this comment was disrespectful, please report it.)

 
12/15/2007 5:30:57 PMJorge

its a great code, thanks for sharing
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.