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 » Accessing GridCell's in a CExtTreeGridWnd Collapse All
Subject Author Date
Bob Sabiston Aug 14, 2006 - 6:26 PM

I’m trying to populate a multi-column CExtTreeGridWnd with various cells. If I insert a top level node into the tree with a
ItemInsert( NULL, ULONG(-1), 1 );


Bob Sabiston Aug 14, 2006 - 6:34 PM

sorry, accidentally hit Post without finishing this...

getting back to the problem, if I insert a top level node with
HTREEITEM hTopLevelItem = ItemInsert (NULL, ULONG(-1), 1);
I can go ahead and insert cells ...
    CExtGridCellStringDM * pCellName =    STATIC_DOWNCAST(CExtGridCellStringDM,
                            GridCellGet(
                                0L,
                                iRow,
                                0,
                                0,
                                RUNTIME_CLASS(CExtGridCellStringDM)
                                )
                            );    
    pCellName->TextSet (strName.c_str() );

etc.

The problem is if I go and create a child node...
HTREEITEM hLevel1Node = ItemInsert(hTopLevelItem, ULONG(-1),1);

and then try and populate it’s cell’s as before, the
CExtGridCellStringDM * pCellName =    STATIC_DOWNCAST(CExtGridCellStringDM,
                            GridCellGet(
                                0L,
                                iRow,
                                0,
                                0,
                                RUNTIME_CLASS(CExtGridCellStringDM)
                                )
                            );
just returns NULL.

What do I have to do to get this working.

Thanks

Technical Support Aug 15, 2006 - 6:44 AM

The CExtGridWnd class implements a plain grid window with zero-based column/row indices. The CExtTreeGridWnd class implements a vertical multi column tree control and uses zero-based column indices in horizontal direction and HTREEITEM row handles in vertical direction. We recommend you use the CExtTreeGridWnd::Item***() methods when working with the tree grid control. For instance, the CExtTreeGridWnd::ItemGetCell() method is similar to CExtGridWnd::GridCellGet(). You can also convert plain row numbers to HTREEITEM handles and vice versa. The CExtTreeGridWnd::ItemGetByVisibleRowIndex() method converts a zero-based row index to the corresponding HTREEITEM handle. The CExtTreeGridWnd::ItemGetVisibleIndexOf() method converts a HTREEITEM handle to the corresponding zero-based row index or returns a negative value if at least one parent tree row is in the collapsed state.

Bob Sabiston Aug 15, 2006 - 10:33 AM

Thank you, this did the trick.