Solved

How to add /delete  "+"   Symbol in TreeView for an empty tree Item

Posted on 1999-01-21
4
161 Views
Last Modified: 2013-11-20
2) A question in TreeCtrl ......
 
In Windows Explorer , u will see a "+" sign just before a empty Directory and when u click on the "+" sign the "+" sign disappears showing that directory is empty !!!
 
I would like to implement something like that .... is there any extended flag available for the above method ????

thanks
senthil
0
Comment
Question by:senthil_k
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
Comment Utility
No, just add a dummy child to the tree node. When the user clicks on the node, you get a notification. In the response to this notification, if you delete the empty node, then you'll get the disappearing +.
0
 

Author Comment

by:senthil_k
Comment Utility
Hi Thui,
Thanks for ur suggestion as I am aleady doing that trick !!!!
I have come across a member of TVITEM Structure named cChildren and if u specify the value of cChildren to  1 then the treeview displays a "+" sign by default assuming that there will be one or more child items for that parent Item...but when I click on that Parent Item the "+" symbol does not disappear !!!!

If u have any suggestions regarding the above method !!! please mail back to me ....

thanks
senthil
0
 
LVL 15

Expert Comment

by:Tommy Hui
Comment Utility
You should not set the children count to 1 because this will confuse the control. Instead, as I suggested, insert a dummy child item. You then need to respond to TVN_ITEMEXPANDING and delete the dummy child control.
0
 

Author Comment

by:senthil_k
Comment Utility
Thanks for ur suggestion as u r right If I try to assign 0 to a particular item, tree control removes the "+" sign of other tree items which has children item .......it does it randomly ..as u say it gets cinfused !!!!!!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the fileā€¦

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now