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 » Stubborn CExtGridCellPictureRef cells in outer-top row of CExtTreeGridWnd will not change width Collapse All
Subject Author Date
Krustys Donuts Jun 4, 2008 - 10:46 AM

I have a CExtTreeGridWnd that has one outer row at the top. Some of these outer cells have text (CExtGridCellHeader) and others have bitmaps (CExtGridCellPictureRef). The problem is that the cells containing the bitmaps are wider than desired. I have used the BestFitRow routine to adjust the height of this top row appropriately and I have been using the ExtentSet method to set the width of the cells. This later method works fine on the cells with text, but seems to have no effect on the cells with bitmaps. I have also tried, with no success, calling BestFitColumn on each of the columns to achieve my goal. Below is my initializtion code, am I missing something???


Thanks,


Gil


 


 



void VRTeachpointGrid::Initialize(bool bRedraw)
{
    if (m_bInitialized)
        return;

    m_bInitialized = true;

    //Enable
    SiwModifyStyle(        __ESIS_STH_PIXEL |
                        __EGBS_SUBTRACT_SEL_AREAS |
                        __ESIS_STV_ITEM |
                        __EGBS_SFB_FULL_ROWS |
                        __EGBS_RESIZING_CELLS_OUTER_H |
                        __EGBS_DYNAMIC_RESIZING |
                        __EGBS_MULTI_AREA_SELECTION |
                        __EGBS_NO_HIDE_SELECTION |
                        __EGBS_GRIDLINES,
                        0, false);

    //Disable
    SiwModifyStyle(0,    __EGBS_SFM_ROWS,
                        false);

    //Enable
    SiwModifyStyleEx(    __EGBS_EX_CELL_TOOLTIPS,
                        0, false);

    //Disable
    SiwModifyStyleEx(0,    __EGBS_EX_CELL_EXPANDING_INNER |
                        __EGBS_EX_CELL_EXPANDING |
                        false);

    //Enable
    BseModifyStyle(        __EGWS_BSE_EDIT_CELLS_INNER |
                        __EGWS_BSE_EDIT_DOUBLE_LCLICK |
                        __EGWS_BSE_EDIT_RETURN_CLICK,
                        0, false);
    
    //Disable
    BseModifyStyle(0,    __EGWS_BSE_EDIT_SINGLE_LCLICK |
                        __EGWS_BSE_EDIT_SINGLE_FOCUSED_ONLY |
                        __EGWS_BSE_EDIT_AUTO |
                        __EGWS_BSE_SORT_COLUMNS_T,
                        false);

    EnableTooltips(true, true, true, true, true);
    EnableExpanding(false, false, false, false, false);
    RemoveAllRows( false );
    ColumnRemoveAll( false );
    OuterRowCountTopSet( 1L, false );
    ColumnAdd( (LONG)m_arGridHdrInfo.size(), false );

    //Make the Name column a filter column.
    CExtGridCellHeaderFilter * pFilterCell =
        STATIC_DOWNCAST(    CExtGridCellHeaderFilter, GridCellGet(kNameCol, 0L, 0, (-1),
                            RUNTIME_CLASS(CExtGridCellHeaderFilter)));

    pFilterCell->ModifyStyleEx( __EGCS_EX_WRAP_TEXT);
    pFilterCell->ModifyStyle(__EGCS_SORT_ARROW );
    pFilterCell->TextSet( m_arGridHdrInfo[kNameCol].m_strName.c_str() );
    pFilterCell->ExtentSet( m_arGridHdrInfo[kNameCol].m_nMinWidth, -1);
    pFilterCell->ExtentSet( m_arGridHdrInfo[kNameCol].m_nMaxWidth, 1);
    pFilterCell->ExtentSet( m_arGridHdrInfo[kNameCol].m_nCurWidth, 0);
    pFilterCell->m_bSortingCommandsEnabled = true;
    pFilterCell->m_bTextFiltersEnabled = false;
    pFilterCell->m_bValueFiltersEnabled = false;
    pFilterCell->m_bDynamicValueFilters = false;

    CExtBitmap*    pBmp = NULL;
    for (UINT i=kLockedCol; i<m_arGridHdrInfo.size(); i++)
    {
        //If this cell has an associated bitmap.
        if (m_arGridHdrInfo[i].m_pBitmap != NULL)
        {
            VRCellPicture* pCell;
            pCell = STATIC_DOWNCAST(VRCellPicture, GridCellGet(i, 0L, 0, (-1), RUNTIME_CLASS(VRCellPicture)));

            pCell->BitmapSetBuffer(m_arGridHdrInfo[i].m_pBitmap);
            pCell->ExtentSet( m_arGridHdrInfo[i].m_nMinWidth, -1);
            pCell->ExtentSet( m_arGridHdrInfo[i].m_nMaxWidth, 1);
            pCell->ExtentSet( m_arGridHdrInfo[i].m_nCurWidth, 0);
            pCell->ImageModeSet( VRCellPicture::eAlign );
            pCell->ModifyStyle(__EGCS_TA_HORZ_CENTER | __EGCS_TA_VERT_CENTER);
            if (m_arGridHdrInfo[i].m_nTooltipId != 0)
                pCell->SetTooltip(st.GetString(m_arGridHdrInfo[i].m_nTooltipId));
        }
        else    //There must be a string associted to this cell.
        {
            VRCellHeader* pCell;
            pCell = STATIC_DOWNCAST(VRCellHeader, GridCellGet(i, 0L, 0, (-1),
                                    RUNTIME_CLASS(VRCellHeader)));

            pCell->ModifyStyleEx( __EGCS_EX_WRAP_TEXT );
            pCell->TextSet( m_arGridHdrInfo[i].m_strName.c_str() );
            pCell->ExtentSet( m_arGridHdrInfo[i].m_nMinWidth, -1);
            pCell->ExtentSet( m_arGridHdrInfo[i].m_nMaxWidth, 1);
            pCell->ExtentSet( m_arGridHdrInfo[i].m_nCurWidth, 0);
            pCell->ModifyStyle(__EGCS_TA_HORZ_CENTER | __EGCS_TA_VERT_CENTER);
            if (m_arGridHdrInfo[i].m_nTooltipId != 0)
                pCell->SetTooltip(st.GetString(m_arGridHdrInfo[i].m_nTooltipId));
        }
    }

    BestFitRow(0, -1);

    if (bRedraw)
    {
        OnSwUpdateScrollBars();
        OnSwDoRedraw();
    }
}

Technical Support Jun 6, 2008 - 1:05 PM

We cannot say what is wrong without having a test project. We tried to use your code but failed. Because we know nothing about the m_arGridHdrInfo array like how it is declared and initialized. We also don’t know what the VRCellHeader, VRCellPicture and pCell->SetTooltip entities are. Would you create a test project or reproduce the problem in one of our samples, i.e. FilteredGrids and send it to us?