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 General Discussion » CExtGridWnd questions: Multiline Cell and Radio Button Collapse All
Subject Author Date
Johannes Schwenk Jun 16, 2009 - 10:49 AM

Hallo,


1. I`m trying to AutoResize a Multiline Cell, but nothing happens. I can`t resize the row manually, too. What am I do wrong?


2. Is it possible, to uncheck all other radio buttons in the whole Grid, if one of the radio buttons is checked?


MyCode:


 


    m_puisgrid.SiwModifyStyle(
              (__ESIS_STH_PIXEL|__ESIS_STV_ITEM)    // item scroll window styles
            | __EGBS_SFB_CELLS                        // selection/focus type
            | __EGBS_RESIZING_CELLS_OUTER            // enable row/column resizing
            | __EGBS_RESIZING_CELLS_INNER            
            | __EGBS_DYNAMIC_RESIZING                // resize rows/columns on-the-fly
            //|__ESIS_DISABLE_AUTOHIDE_SB_H|__ESIS_DISABLE_AUTOHIDE_SB_V
            ,
        0,
        false
        );
    m_puisgrid.BseModifyStyleEx(
              __EGBS_BSE_EX_DBLCLK_BEST_FIT_ROW        // do best fit sizing on double clicks over column divider
            | __EGBS_BSE_EX_DBLCLK_BEST_FIT_COLUMN    // do best fit sizing on double clicks over row divider
        ,
        __EGWS_BSE_EX_DEFAULT,
        false
        );
    m_puisgrid.BseModifyStyle( 
        __EGWS_BSE_SORT_COLUMNS, 
        0, 
        false 
        );
    m_puisgrid.SiwModifyStyleEx(
              __EGBS_EX_CELL_TOOLTIPS_INNER
            | __EGBS_EX_CELL_EXPANDING_INNER
            | __EGWS_EX_PM_COLORS
            | __EGBS_EX_CORNER_AREAS_3D            
            ,
        0,
        false
        );

    m_puisgrid.OuterRowCountTopSet( 1L, false );

    m_puisgrid.ColumnAdd( 2L );
    m_puisgrid.RowAdd( 2L, false );
    
    CExtGridCellHeader* celltop1 = (CExtGridCellHeader*)m_puisgrid.GridCellGetOuterAtTop( 0L, 0L, RUNTIME_CLASS(CExtGridCellHeader) );
    CExtGridCellHeader* celltop2 = (CExtGridCellHeader*)m_puisgrid.GridCellGetOuterAtTop( 1L, 0L, RUNTIME_CLASS(CExtGridCellHeader) );
    CExtGridCellString* cell1 = (CExtGridCellString*)m_puisgrid.GridCellGet( 0L, 0L, 0, 0, RUNTIME_CLASS(CExtGridCellString) );
    CExtGridCellRadioButton* cell2 = (CExtGridCellRadioButton*)m_puisgrid.GridCellGet( 1L, 1L, 0, 0, RUNTIME_CLASS(CExtGridCellRadioButton) );
    CExtGridCellString* cell3 = (CExtGridCellString*)m_puisgrid.GridCellGet( 0L, 1L, 0, 0, RUNTIME_CLASS(CExtGridCellString) );
    CExtGridCellRadioButton* cell4 = (CExtGridCellRadioButton*)m_puisgrid.GridCellGet( 1L, 0L, 0, 0, RUNTIME_CLASS(CExtGridCellRadioButton) );

    celltop1->TextSet( _T("Header1") );
        celltop1->ExtentSet( 150 ); // column width = 150 pixels
    celltop2->TextSet( _T("Header2") );
        celltop2->ExtentSet( 250 ); // column width = 250 pixels
    
    cell1->TextSet("AZeile1\r\nAZeile2\r\nZeile3");
    cell1->ModifyStyleEx( __EGCS_EX_WRAP_TEXT );
    cell3->TextSet("AZeile1\r\nAZeile2\r\nZeile3");
    cell3->ModifyStyleEx( __EGCS_EX_WRAP_TEXT );

    m_puisgrid.BestFitRow( 0L );
    m_puisgrid.BestFitRow( 1L );
    m_puisgrid.OnSwUpdateScrollBars();
    m_puisgrid.OnSwDoRedraw();

 


I used the DemoProject from my last Thread. You can download the whole solution here.


 

Johannes Schwenk Jun 16, 2009 - 10:51 AM

What i forgot to say: I`m trying to resize the multiline cell in height with the BestFitRow() function.

Technical Support Jun 16, 2009 - 12:45 PM

The CExtGridWnd control uses outer header grid cells in outer header rows to store information about the column width. By default, it tries to find header cells at top, then at bottom and uses the CExtGridCell::Extent***() methods for operating with column width. If the grid control does not have header cells at top/bottom, then it’s not possible to specify variable column widths and all the column widths are equal to the value in pixels returned by the CExtGridWnd::DefaultColumnWidthGet() method. Some people need to see grid columns with variable sizes but does not need outer header rows at top/bottom. It’s possible to make outer header rows having zero pixel height using the CExtGridWnd::OuterRowHeightSet() method.

The same mechanism is applied to grid rows. The grid control looks for the header rows at left, then at right. The similar CExtGridWnd::DefaultRowHeightGet() and CExtGridWnd::OuterColumnWidthSet() methods are provided. The CExtGridCell::Extent***() methods invoked for the header cells in outer header column are operating with the row heights.

Your grid does not have the outer header columns. There is no place to save information about measured row height. The CExtGridWnd::BestFitRow() method does not know where to save measured result. If you run the new version of your test project, then you can start the grid row resizing but the rows does not become resized.

We modified the last version of your test project:

http://www.prof-uis.com/download/forums/tmp/FIXED-STEP-2-ProfUisGridDemoProject.zip

Please search for the PROF-UIS TECH SUPPORT text in comments.