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 » Having trouble adding an item to CExtTreeGridWnd Collapse All
Subject Author Date
Scott Moore Dec 1, 2006 - 3:19 PM

I’ve implemented a CExtResizableDialog with a custom control. The Class of the custom control is set to "ProfUIS-ScrollItemWindow".


in header file:
    CExtTreeGridWnd _reportsTree;

In DoDataExchange(), I do this:

    DDX_Control(pDX, IDC_REPORTS_TREE, _reportsTree); // IDC_REPORTS_TREE is the ID for the custom control on the dialog resource


I found some sample code in the prof ui help file that basically did this to add the first item to the tree:

    HTREEITEM htiRoot = _reportsTree.ItemGetRoot(); // Very top root item, which is invisible
    HTREEITEM htiCurrent = _reportsTree.ItemInsert( htiRoot, ULONG(-1) );
    ASSERT ( htiCurrent != NULL );
    CExtGridCellCheckBox * pCell = (CExtGridCellCheckBox *)
        _reportsTree.ItemGetCell(htiCurrent, 0,0,RUNTIME_CLASS(CExtGridCellCheckBox)); //Get the string cell in column 0
    ASSERT ( pCell != NULL ); // this always asserts
    pCell->TextSet(L"My Checkbox");


However, pCell is always NULL. htiCurrent has a valid HTREEITEM though.

What am I doing wrong?

Thanks,
Scott

P.S. This is with 2.61

Scott Moore Dec 2, 2006 - 2:15 PM

Thank you, that did help some. However, the column width was very small and cut off most of the text for all my checkboxes. I finally discovered the DefaultColumnWidthSet() method which solved that.

I’ve also had problems with ItemGetFirstChild(root), which always returns NULL. However, ItemGetChildAt(root, 0) works fine.


My other question is how easy is it to add tooltips for each of my checkboxes (e.g., show a tooltip when the user selects a HTREEITEM).

Thanks,
Scott

Technical Support Dec 7, 2006 - 1:22 PM

We are sorry for the delay with this reply. You should add one outer header row at the top using CExtGridWnd::OuterRowCountTopSet() and instantiate a CExtGridCellHeader cell in it. This will allow you to specify the column width using the ExtentSet() method of the header cell. You could also use the proportional column resizing of the grid window so that the column(s) can automatically be stretched to grid’s width. You can do this by applying the __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTH style using the CExtGridWnd::BseModifyStyleEx() method. The proportional width of the particular column can be specified with ExtentPercentSet() of the column’s header cell. You can hide the header row by setting its height to zero with the CExtGridWnd::OuterRowHeightSet() method.

The bug related to the ItemGetFirstChild() method was fixed in Prof-UIS 2.62. The CExtGridBaseWnd::EnableExpanding() method allows you to turn on the expand tip for grid cells.

Technical Support Dec 2, 2006 - 11:04 AM

Please try invoking the following code before initializing tree rows:

_reportsTree.ColumnAdd( 1, false );