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 column width different in release and debug builds Collapse All
Subject Author Date
Dylan da Silva Sep 7, 2010 - 10:36 AM

we set the grid style like this :


this->SiwModifyStyle(__ESIS_STH_NONE|__ESIS_STV_ITEM| __EGBS_SFB_CELLS
            |__EGBS_RESIZING_CELLS_OUTER|__EGBS_DYNAMIC_RESIZING
            |__EGBS_GRIDLINES,0,false);
    this->SiwModifyStyleEx(__EGWS_EX_PM_COLORS,0,false);
    
    this->BseModifyStyleEx(__EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS, 0, false);

Then the header row like this:



this->OuterRowCountTopSet( 1, false );
    this->ColumnAdd( NUM_COLUMNS, false );

    for (UINT i = 0; i < NUM_COLUMNS; ++i)
    {
        CExtGridCell * pCell = GridCellGetOuterAtTop(i, 0, RUNTIME_CLASS( CExtGridCellHeader));
        if (pCell)
        {
            pCell->ExtentSet( 50, -1 );
            pCell->ExtentSet( 100);
            pCell->ExtentPercentSet( COLUMN_WIDTH_PERCENTAGE[i] );
            pCell->ModifyStyle(__EGCS_TA_HORZ_CENTER);
            pCell->FontWeightSet(FW_BOLD);
            switch( i )
            {
                case 0: pCell->TextSet(ALARM_TXT); break;
                case 1: pCell->TextSet( NAME_TXT ); break;
                case 2: pCell->TextSet( VALUE_TXT ); break;
                case 3: pCell->TextSet( DESCRIPTION_TXT );
            }
        }
    }

This seems to work in debug exactly as it’s coded above with column widths as specified.  However, when built in release the columns are set to default widths which has them crammed up against the left hand side of the grid.  Why does this work in Debug and not in Release?


We’re using VS2008 and Prof-UIS v2.88.

Technical Support Sep 8, 2010 - 4:54 AM

Did you try to invoke the following code at the end of the grid initialization code?

   pGridWnd->OnSwUpdateScrollBars();
            pGridWnd->OnSwRecalcLayout( true );

Dylan da Silva Sep 8, 2010 - 11:29 AM

Didn’t fix the issue.  Here’s the grid init code:


   

this->OuterRowCountTopSet( 1, false );
    this->ColumnAdd( NUM_COLUMNS, false );

    for (UINT i = 0; i < NUM_COLUMNS; ++i)
    {
        CExtGridCell * pCell = GridCellGetOuterAtTop(i, 0, RUNTIME_CLASS( CExtGridCellHeader));
        if (pCell)
        {
            // this is redundant/unneccesary
            /*pCell->ExtentSet( 50, -1 );
            pCell->ExtentSet( 100);*/
            pCell->ExtentPercentSet( COLUMN_WIDTH_PERCENTAGE[i] );
            pCell->ModifyStyle(__EGCS_TA_HORZ_CENTER);
            pCell->FontWeightSet(FW_BOLD);
            switch( i )
            {
                case 0: pCell->TextSet(ALARM_TXT); break;
                case 1: pCell->TextSet( NAME_TXT ); break;
                case 2: pCell->TextSet( VALUE_TXT ); break;
                case 3: pCell->TextSet( DESCRIPTION_TXT );
            }
        }
    }
    this->OnSwUpdateScrollBars();
    this->OnSwRecalcLayout( true );

Technical Support Sep 9, 2010 - 8:27 AM

We cannot reproduce this. The different column widths (but not very different, only a few pixels) in debug and release can happen only if the initial width of the grid control is different in debug and release. Please insert the following test code at the end of the grid control initialization to check this:

CRect rcGrid;
pGrid->GetClientRect( &rcGrid );
CString str;
str.Format( _T("Grid width is %d"), rcGrid.Width() );
::AfxMessageBox( str );
If the grid control’s widths are different in debug and release modes, then we need to know more details about where it’s created exactly. If grid widths are equal, then we will had to ask you to create a stripped version of your project containing UI code only and send it to us.

Dylan da Silva Sep 7, 2010 - 10:40 AM

We’ve had to hack and add a call to BestFitColumn() on each column after inserting a new row.