Solved

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

Posted on 1999-01-21
4
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1328169
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
ID: 1328170
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
ID: 1328171
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
ID: 1328172
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 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