Re: HTREEITEM
"Al" <Al@discussions.microsoft.com> wrote in message
news:408287A5-9A60-4968-98D5-DD38244479BE@microsoft.com...
I want to have a CArray of type x. A user will add data to a list control
through a form. Then set the size of the CArray to the size of the list.
Transfer the initial data from the list control to the CArray and somehow
declare HTREEITEMS for each of the CArry objects in a tree control. Please
bear with me about my explaination.
--
Just Al
As you've probably guessed by now, there are some quite knit picky
developers that frequent these news groups. I remember back in the day...ah
nevermind. Try something like this (off the top of my head so...)
// NOTE: For this example we will assume an array of user structs which
contain a list of subitems.
//
// Something like this...
// struct
// {
// CString name;
// int num;
// int subItemCnt;
// SubItems** subItems;
// }ItemListType;
typedef CArray<ItemListType*, ItemListType*&> CTreeViewData;
bool CSomeClass::LoadTreeControl( CTreeControl& tvCtrl, CTreeViewData&
data )
{
HTREEITEM htiParent;
HTREEITEM htiChild;
ItemListType* itemData;
int s;
for( int j= 0; j < data.GetCount(); j++ )
{
itemData= data.ElementAt( j );
ASSERT( itemData != NULL );
htiParent= tvCtrl.InsertItem( itemData->name );
s= 0;
while( *(itemData->subItems[s]) != NULL )
{
htiChild= tvCtrl.InsertItem( *(itemData->subItems[s])->name,
htiParent );
++s;
}
}
}
While this may not be exactly what you want, it should point you in the
right direction.
--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.