Solved

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

Posted on 1999-01-21
4
165 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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