Quickest way to get childern of CTreeCtr
-
What is the best way to get the number of items from a 'branch' of a tree control, so I can put a number in brackets behind the name of the parent. ROOT - People (2) * Paul * John - Kids (3) * Jack * Tom * William So in this case I want to know how many items have "people" as parent. (that's two) GetCount() returns the total number of counts, so that's useless. Also, how can I change the name of an already existing item in a treeview? Who can help me out? Cheers!
-
What is the best way to get the number of items from a 'branch' of a tree control, so I can put a number in brackets behind the name of the parent. ROOT - People (2) * Paul * John - Kids (3) * Jack * Tom * William So in this case I want to know how many items have "people" as parent. (that's two) GetCount() returns the total number of counts, so that's useless. Also, how can I change the name of an already existing item in a treeview? Who can help me out? Cheers!
[nt]
-
[nt]
While many of us know the solution, it would be great if you could share your solution as well. That way, another person searching for this will find a complete solution. Besides, you might have come up with a unique way of completing the task that would teach us all. Cheers, Tom Archer Author, Inside C# Author, Visual C++.NET Bible A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
-
While many of us know the solution, it would be great if you could share your solution as well. That way, another person searching for this will find a complete solution. Besides, you might have come up with a unique way of completing the task that would teach us all. Cheers, Tom Archer Author, Inside C# Author, Visual C++.NET Bible A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CBitmap bitmap;
CBrush brush;bitmap.LoadBitmap(IDB_BACKG);
int nCtrl = pWnd->GetDlgCtrlID();
pDC->SetBkColor(RGB_VALUE);if ( NULL != brush.m_hObject )
::DeleteObject(brush);brush.CreatePatternBrush(&bitmap);
hbr = brush;
return hbr;This is not written by me though, I read something like this somewhere else.
-
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CBitmap bitmap;
CBrush brush;bitmap.LoadBitmap(IDB_BACKG);
int nCtrl = pWnd->GetDlgCtrlID();
pDC->SetBkColor(RGB_VALUE);if ( NULL != brush.m_hObject )
::DeleteObject(brush);brush.CreatePatternBrush(&bitmap);
hbr = brush;
return hbr;This is not written by me though, I read something like this somewhere else.
Um...what does this have to do with getting the children of a HTREEITEM :) Cheers, Tom Archer Author - Inside C#, Visual C++.NET Bible A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
-
Um...what does this have to do with getting the children of a HTREEITEM :) Cheers, Tom Archer Author - Inside C#, Visual C++.NET Bible A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
Oops, I answered the wrong question of myself here. :) My solution to this one was pretty cheap, I just made a counter (structure with HTREEITEM and an INT) and every time an item was added to a part of a tree I updated the counter. As the user could not add or delete things from the tree, this solution worked quite well. I used GetItemtext(..), added "(%d)" to the string and set the new string with SetItem(..) But I take it this was not the 'obvious' solution :)