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 » Grid cell questions Collapse All
Subject Author Date
Paul Cowan Jan 10, 2007 - 2:34 PM

Several questions about different grid cells:

1. How can I get an empty, but editable numeric cell? It seems that the cell it not editable until I assign a value, even 0, but then the value is displayed in the cell. I would like the cell to be empty until a value is entered.

2. How to change the format of the date in a CExtGridCellDateTime cell. It seems to be using the Windows short date format, how can I specify a custom format?

3. How to hide the None button on the pop-up calendar from the CExtGridCellDateTime cell.

4. How to get the top/left corner filled in. I have a top header and left header and would like a corner between the two. I’ve tried using __EGBS_EX_CORNER_AREAS_3D with the grid SiwModifyStyle, but it’s not working.

Paul Cowan Jan 12, 2007 - 2:48 PM

I didn’t need to override ::OnGbwEraseArea The code given didn’t draw the 3D look in the corners.
I used SiwModifyStyleEx (__EGBS_EX_CORNER_AREAS_3D to draw the corner

Technical Support Jan 12, 2007 - 12:31 PM

In addition to what Chris wrote we would like to add the following:

1. There is a new __EGCS_EX_EMPTY cell style that werer added in Prof-UIS v2.62 and it is exactly what you are looking for.

2. In the CExtGridCellDateTime::OnQueryDatePickerStyle() overridden method do not specify __EDPWS_BUTTON_NONE style.

3. The grid control does not display cell objects in corners but you can repaint them if you need to display some information there. You should override the CExtGridBaseWnd::OnGbwEraseArea() virtual method like as follows:

void C_YOUR_GridWnd::OnGbwEraseArea(
    CDC & dc,
    const RECT & rcArea,
    DWORD dwAreaFlags
    ) const
{
    ASSERT_VALID( this );
    ASSERT( dc.GetSafeHdc() != NULL );
COLORREF clrDebugFill = COLORREF( -1L );
    switch( dwAreaFlags )
    {
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_TOP:
        clrDebugFill = RGB( 255, 128, 128 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_BOTTOM:
        clrDebugFill = RGB( 128, 255, 128 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT:
        clrDebugFill = RGB( 128, 128, 255 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT:
        clrDebugFill = RGB( 128, 255, 255 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT|__EGBWA_OUTER_TOP:
        clrDebugFill = RGB( 255, 128, 255 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT|__EGBWA_OUTER_BOTTOM:
        clrDebugFill = RGB( 255, 255, 128 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT|__EGBWA_OUTER_TOP:
        clrDebugFill = RGB( 255, 255, 128 );
    break;
    case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT|__EGBWA_OUTER_BOTTOM:
        clrDebugFill = RGB( 128, 128, 128 );
    break;
    case __EGBWA_INNER_CELLS:
        clrDebugFill = RGB( 255, 255, 224 );
    break;
    }
    if( clrDebugFill != COLORREF( -1L ) )
        dc.FillSolidRect( &rcArea, clrDebugFill );
}

Paul Cowan Jan 12, 2007 - 10:10 AM

Thanks for the reply I do have v2.62

Some comments for future reference:

1. For the empty cell, you still need to assign a value:
    pCellNumber->_VariantAssign (0);
    pCellNumber->Empty();

4. The __EGBS_EX_CORNER_AREAS_3D does work, but you need to use SiwModifyStyleEx, I was using SiwModifyStyle

Suhai Gyorgy Jan 12, 2007 - 8:03 AM

1. Prof-UIS v2.62 has what you need here. From Version History:
- Added an __EGCS_EX_EMPTY extended cell style, which makes the cell empty. The empty style is automatically removed when the user starts entering some value in the cell.
- Added CExtGridCell::IsEmpty() and CExtGridCell::Empty() methods, which allow you to check if the cell is empty and make it empty.

2. I’m just guessing here. I checked v2.62 implementation for CExtGridCellDateTime::TextGet. That does all the formatting, but it gets the format from the OS’ locale settings. What you can set from outside the cell is:
- CExtGridCellDateTime::SetMode : Sets a new display mode (only time, only date, or date and time).
- CExtGridCellDateTime::SetTimeFormat : Sets a new time format (12-hour, 24-hour or automatically detected).
If you want to do other settings, you should override CExtGridCellDateTime::TextGet. Check default implementation.

3. There’s a virtual DWORD OnQueryDatePickerStyle() const; private method in CExtGridCellDateTime. Default implementation returns a combination of CExtDatePickerWnd styles. You should override this method and set your own styles.

In SimpleGrids sample you can see that overriding a CExtGridCell-derived class is a little more tricky than overriding a usual class. Check implementation of CDemoColoredCell in that sample.

4. There’s a thread in this forum on this topic already. You can find it fast if you do a search on the word "intersection". The topic is entitled Grid Columns. Although it’s a quite old thread, I think it’s still applicable now.