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 » Button in cell Collapse All
Subject Author Date
Paolo Giustinoni Jul 10, 2006 - 8:39 AM

Sorry to disturb you, but I have a question about your example "ForMarianne", in which you show how to insert a push button in a cell.. It’s all ok, but how can I center this button in the cell? The style is __EGCS_BUTTON_ELLIPSIS |__EGCS_ICA_HORZ_CENTER |__EGCS_ICA_VERT_CENTER (like in your example) but it’s seem that has no effect on the button. Is there also the possibility to create a bitmap button in the cell?

Thanks in advance.
Paolo

Technical Support Jul 10, 2006 - 11:12 AM

The original version of the sample in question is available here (we renamed it to SimpleGridOnDialog). The button cell in your message is controlled by the CMyStartStopCell class, which recomputes its size and re-paints its built-in ellipsis button in the CExtGridCell object. To make this button centered, you should add the following virtual method to the CMyStartStopCell class:

    virtual void OnCalcLayout(
        DWORD dwCellStyle,
        DWORD dwCellStyleEx,
        CRect & rcCellRest,
        CRect & rcCellText,
        CRect & rcFocusArrow,
        CRect & rcIcon,
        CRect & rcCheck,
        CRect & rcSortArrow,
        CRect & rcUpdownButtonTop,
        CRect & rcUpdownButtonBottom,
        CRect & rcDropdownButton,
        CRect & rcEllipsisButton,
        CSize sizeFocusArrow,
        CSize sizeIcon,
        CSize sizeCheck,
        CSize sizeSortArrow,
        INT nExtentUpdownButton,
        INT nExtentDropdownButton,
        INT nExtentEllipsisButton,
        INT & nFocusGlyphType,
        const CExtGridWnd & wndGrid,
        CDC & dc,
        LONG nVisibleColNo,
        LONG nVisibleRowNo,
        LONG nColNo,
        LONG nRowNo,
        INT nColType,
        INT nRowType,
        DWORD dwAreaFlags,
        DWORD dwHelperPaintFlags
        ) const
    {
        ASSERT_VALID( this );
        CRect rc = rcCellRest;
        CExtGridCell::OnCalcLayout(
            dwCellStyle,
            dwCellStyleEx,
            rcCellRest,
            rcCellText,
            rcFocusArrow,
            rcIcon,
            rcCheck,
            rcSortArrow,
            rcUpdownButtonTop,
            rcUpdownButtonBottom,
            rcDropdownButton,
            rcEllipsisButton,
            sizeFocusArrow,
            sizeIcon,
            sizeCheck,
            sizeSortArrow,
            nExtentUpdownButton,
            nExtentDropdownButton,
            nExtentEllipsisButton,
            nFocusGlyphType,
            wndGrid,
            dc,
            nVisibleColNo,
            nVisibleRowNo,
            nColNo,
            nRowNo,
            nColType,
            nRowType,
            dwAreaFlags,
            dwHelperPaintFlags
            );
        rcEllipsisButton.OffsetRect(
            - ( rc.Width() - rcEllipsisButton.Width() ) / 2,
            ( rc.Height() - rcEllipsisButton.Height() ) / 2
            );
    }

Paolo Giustinoni Jul 10, 2006 - 11:29 AM

Thank you very much for your response.
What about to insert a bitmap button in a cell?

Thanks, Paolo

Technical Support Jul 11, 2006 - 8:39 AM

Please run the ProfUIS_Controls sample and select the Grid page. The Picture column contains CExtGridCellPicture cell objects. Try resizing this column and some row to see features of this cell class.