Click here to Skip to main content
15,902,911 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bubble Tool Tips Pin
Ancient Dragon22-Mar-03 11:52
Ancient Dragon22-Mar-03 11:52 
GeneralRe: Bubble Tool Tips Pin
Eugene Pustovoyt23-Mar-03 4:48
Eugene Pustovoyt23-Mar-03 4:48 
GeneralRe: Bubble Tool Tips Pin
Ancient Dragon23-Mar-03 7:34
Ancient Dragon23-Mar-03 7:34 
GeneralCreating VC6 compatible library with VC7 Pin
Mikko Mononen22-Mar-03 10:14
Mikko Mononen22-Mar-03 10:14 
Generalusing CTreeCtrl with a CObArray Pin
Colin Davidson22-Mar-03 8:02
Colin Davidson22-Mar-03 8:02 
GeneralRe: using CTreeCtrl with a CObArray Pin
MAAK22-Mar-03 9:09
MAAK22-Mar-03 9:09 
GeneralRe: using CTreeCtrl with a CObArray Pin
Colin Davidson22-Mar-03 9:22
Colin Davidson22-Mar-03 9:22 
GeneralRe: using CTreeCtrl with a CObArray Pin
MAAK22-Mar-03 10:11
MAAK22-Mar-03 10:11 
Pardon me, I cannot undestand this line of code (do not know what is the type of versionPtr).

To demonstrate, I will assume that versionPtr is an object of type CMyObject and the member function GetVersionLabel() returns a string of that object contents. And finally that we have a CObArray named objArr containing objects of type CMyObject.

Using this assumption, this is how to link the tree items to the array:

int arrIndex;  //this should hold the index of the object
.
.
//inserting the object number [arrIndex] into the tree
CMyObject * pMyObj = (CMyObject *)objArr.GetAt(arrIndex);
HTREEITEM hItem = m_tTreeCtrl.InsertItem(pMyObj->GetVersionLabel());
//now we set the item's data
//BTW, DWORD is a #define for usigned int
m_tTreeCtrl.SetItemData(hItem, (DWORD)arrIndex);
//now the data is set
//next is how to retreive it
.
.
CMyObject * pMyObj;
//where hItem is the handle of the tree item
int index = (int)m_tTreeCtrl.SetItemData(hItem);
pMyObj = (CMyObject *)objArr.GetAt(index);


This sample store the index of the object in the array, a better approach is to store the address of the object itself. In this case, the item data set line would be:
m_tTreeCtrl.SetItemData(hItem, (DWORD)pMyObj);

and the item data retreival line would be:
pMyObj = (CMyObject *)objArr.m_tTreeCtrl.SetItemData(hItem);


I hope that is what you want.
GeneralRe: using CTreeCtrl with a CObArray Pin
Colin Davidson22-Mar-03 10:25
Colin Davidson22-Mar-03 10:25 
GeneralWM_CTLCOLORSTATIC handler blacks checkboxes Pin
Jared McIntyre22-Mar-03 7:58
Jared McIntyre22-Mar-03 7:58 
Generalhelp needed for crystal edit Pin
cerb-dk22-Mar-03 7:26
cerb-dk22-Mar-03 7:26 
GeneralOutlook style listview control Pin
Kuniva22-Mar-03 4:49
Kuniva22-Mar-03 4:49 
GeneralRe: Outlook style listview control Pin
valikac22-Mar-03 6:35
valikac22-Mar-03 6:35 
GeneralRe: Outlook style listview control Pin
Anonymous22-Mar-03 13:08
Anonymous22-Mar-03 13:08 
GeneralCharts Pin
d.f22-Mar-03 4:41
d.f22-Mar-03 4:41 
GeneralRe: Charts Pin
Nish Nishant22-Mar-03 4:45
sitebuilderNish Nishant22-Mar-03 4:45 
GeneralRe: Charts Pin
d.f22-Mar-03 4:48
d.f22-Mar-03 4:48 
GeneralPls Give me an advice in win shell prog. Pin
M. Agamawi22-Mar-03 3:49
M. Agamawi22-Mar-03 3:49 
GeneralRe: Pls Give me an advice in win shell prog. Pin
22491722-Mar-03 4:46
22491722-Mar-03 4:46 
GeneralRe: Pls Give me an advice in win shell prog. Pin
M. Agamawi22-Mar-03 4:54
M. Agamawi22-Mar-03 4:54 
GeneralRe: Pls Give me an advice in win shell prog. Pin
Michael Dunn22-Mar-03 8:27
sitebuilderMichael Dunn22-Mar-03 8:27 
GeneralMDI - Dialogs - Cascade - Problem! Pin
Nirav Doshi22-Mar-03 3:32
Nirav Doshi22-Mar-03 3:32 
GeneralRe: MDI - Dialogs - Cascade - Problem! Pin
Ravi Bhavnani22-Mar-03 3:51
professionalRavi Bhavnani22-Mar-03 3:51 
GeneralRe: MDI - Dialogs - Cascade - Problem! Pin
Nirav Doshi22-Mar-03 3:59
Nirav Doshi22-Mar-03 3:59 
Generalprintf and unsigned char Pin
leppie22-Mar-03 3:26
leppie22-Mar-03 3:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.