|
|
|
|
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.
Subject |
Author |
Date |
|
ArgUser User
|
Oct 31, 2007 - 6:35 PM
|
I am having a problem getting simple text values to display in the CExtTreeGridWnd class. I started with the code in the downloadable test_tree_grid_idea project, which allows individual tree elements to be added anywhere in the tree. I have been trying to add code to set some simple text in one of the elements. First I called GridCellGet() to attempt to get the cell reference. From there, I was going to call TextSet.
cell = ((CMainFrame *)m_pMainWnd)->m_wndTree.GridCellGet(0,0); cell->TextSet(_T("ABC"));
The problem is that "cell" always gets a NULL pointer from GridCellGet() in the first statement. I cannot get any of the tree cells to display anything. When I change the first line to call ... .GridCellGet(0,0,0,-1), which accesses the header, it works. I need to understand more about the Prof-UIS framework so I can set values in the main part of the tree itself. -- Thanks.
|
|
Technical Support
|
Nov 2, 2007 - 5:52 AM
|
There is a CExtTreeGridWnd::ItemGetCell() method, which you should use to instantiate grid cells inside the tree grid. By default, each grid cell in each tree row is NULL . You can specify the desired cell type by using RUNTIME_CLASS(...) : CExtTreeGridWnd * pTreeGridWnd = . . .
HTREEITEM hti = . . .
LONG nColNo = . . .
CExtGridCell * pCell = pTreeGridWnd->ItemGetCell( hti, nColNo, 0, RUNTIME_CLASS(CExtGridCellString) );
ASSERT_VALID( pCell );
pCell->TextSet( _T("Hello world!") ); The code above instantiates a CExtGridCellString grid cell at the position indicated by column nColNo in tree row hti . The CExtGridWnd::GridCellGet() method should be used with the CExtGridWnd plain grid control and with top/bottom header parts of the CExtTreeGridWnd tree grid. The data cells of tree grid and header cells on left or right should be accessed using the CExtTreeGridWnd::ItemGetCell() method.
|
|