Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Associating user data with HTREEITEM in CExtTreeGridWnd Collapse All
Subject Author Date
David Skok Nov 9, 2006 - 1:47 PM

I have looked but can find no way to assign user data to an HTREEITEM in CExtTreeGridWnd. Using an analogy in MFC CTreeCtrl the fucntion would look similar to this:

BOOL CTreeCtrl::SetItemData( HTREEITEM hItem, DWORD_PTR dwData );

Have I overlooked such a feature, if not can one be added?

I realize it is possible to set user data in CExtGridCells using LPARAM LParamSet( LPARAM lParamNew = 0L ).

Thanks

Suhai Gyorgy Nov 10, 2006 - 4:14 AM

Looking in Help I could find that might be what you need: The class called CExtTreeGridCellNode is derived from CExtGridCell and has a method called CExtTreeGridCellNode::FromHTREEITEM. So if you have the HTREEITEM for which you want to assign the data to, you can get the associated CExtTreeGridCellNode instance with FromHTREEITEM method and call LParamSet for the resulting cell.

David Skok Nov 10, 2006 - 6:48 AM

Thanks, I looked at that function but it didn’t register.

Now I need a way to be notified if a node is being removed from CExtTreeGridWnd perhaps an OnTreeGridCellNodeDelete() event function. Or some way to tell CExtTreeGridWnd to allocate my type of CExtTreeGridCellNode and derive one so that it’s destructor will be called and I will be able to do some cleanup of outside references. The former would be ideal.

Technical Support Nov 10, 2006 - 11:04 AM

You could keep your LPARAM value either in the CExtGridCellTreeNode object or in any other grid cell in the same row. You could also create an invisible header column (of a zero width) and use its cells to store these LPARAM values there.

To catch when the a tree row is removed, you can override the CExtTreeGridWnd::ItemRemove() virtual method.