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 » CExtTreeGridWnd and Icons Collapse All
Subject Author Date
Nigel Channon May 15, 2008 - 2:41 AM

Hi.


I want assign icons with all my items in tree. So... I try use simple code:


parent = m_tree->ItemInsert( NULL );

m_tree->ItemExpand( parent );

CExtGridCell * cell = m_tree->ItemGetCell( parent, 0, 0, RUNTIME_CLASS( CExtGridCellStringDM) );

cell->DataProviderGet()->IconInsert(&m_DeviceIcon,1);

cell->IconIndexSet(1);

cell -> TextSet(L"Simple text");


But in this case I see icons and don`t see text. Where I make mistake?

Nigel Channon May 19, 2008 - 2:58 AM

If I insert icon with greater height as text-height then GridCellRectsGet() will use height (of icon) for computing height of cell?

Technical Support May 19, 2008 - 9:26 AM

In a grid cell, any icon is used without resizing and any other adjustments. You may need to increase the row height and/or column width for the grid cell with a large icon. The best way is to initialize all grid cells in some row/column and then invoke the CExtGridWnd::BestFitColumn() and/or CExtGridWnd::BestFitRow() methods.

Technical Support May 16, 2008 - 2:57 AM

We noticed that you insert an icon object at position 1 in the internal collection of icons inside the data provider object. If it is inserted many times, you may encounter a problem of finding correct icon indices for each particular grid cell.

Besides, you should to re-paint the grid cell area from your code after assigning an icon index to it. The CExtGridWnd::GridCellRectsGet() method allows you to compute grid cell location in client coordinates of grid control for further invalidation. This method returns false if the cell location cannot be computed (the cell is outside the displayed cell range and you don’t need to invalidate its rectangle).