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 » CExtGridWnd in a dialog Collapse All
Subject Author Date
jb lee Mar 5, 2006 - 2:12 PM

Would you please send me a sample for CExtGridWnd in a dialog?

Lukasz Janas May 15, 2006 - 6:13 AM

Could you please send me this example too?
Thanks

Technical Support Mar 6, 2006 - 7:08 AM

We sent the project you requested via e-mail.

Ed Kennedy Apr 30, 2006 - 5:05 PM

Could I get a copy of this sample??

It seems pretty popular! ;)

Thanks,

ed

Sergio Del Valle Apr 19, 2006 - 7:16 AM

Could you send me this sample as well?

Thanks in advance

Technical Support Apr 20, 2006 - 7:50 AM

We sent this project to you by e-mail.

Sergio Del Valle Apr 20, 2006 - 10:28 AM

Thanks for the sample.

I’m having a problem with selection on the grid. I created the control with the same style and exstyle as those in your sample, and created a subclass of CExtGridWnd. When I make a selection on the grid when it doesn’t have focus the selection is correctly shown, but once the grid has focus the selection is not changed in the display, even though it is saved cause when the grid lose focus the last selection is shown correctly again. Here’s the grid code:


class CMyGrid : public CExtGridWnd {
public:
    DECLARE_DYNCREATE(CMyGrid);

// Attributes
public:

// Implementation
public:
    void InitGrid();
};


IMPLEMENT_DYNCREATE(CMyGrid, CExtGridWnd);

void CMyGrid::InitGrid() {
    SiwModifyStyle(__EGBS_FIXED_SIZE_ROWS | __EGBS_SFB_FULL_ROWS |
            __EGBS_GRIDLINES | __EGBS_NO_HIDE_SELECTION, 0, false);

    OuterRowCountTopSet(2);

    ColumnAdd(5, false);
    for (int i = 0; i < 5; i++) {
        CExtGridCell* pCell = GridCellGetOuterAtTop(i, 0,
                RUNTIME_CLASS(CExtGridCellHeader));
        pCell->TextSet("X");
        pCell->ModifyStyle(__EGCS_TA_HORZ_CENTER);
        pCell->ExtentSet(80);
    }

    RowAdd(5, false);
    CExtGridCellVariant* pDataCell;
    for (int i = 0; i < RowCountGet(); i++) {
        for (int j = 1; j < ColumnCountGet(); j++) {
            pDataCell = STATIC_DOWNCAST(CExtGridCellVariant,
                    GridCellGet(j, i, 0, 0, RUNTIME_CLASS(CExtGridCellCurrency)));
            pDataCell->ModifyStyle(__EGCS_NO_INPLACE_CONTROL);
            pDataCell->_VariantAssign(0.0);
        }
    }

    OnSwUpdateScrollBars();
}


I call the InitGrid method in the OnInitDialog of the dialog.

Technical Support Apr 21, 2006 - 7:04 AM

You forgot to specify the scrolling strategy styles (__ESIS_STH_PIXEL|__ESIS_STV_ITEM styles) when invoking SiwModifyStyle(). Here is how to initialize the grid correctly:

void InitGrid()
{
    SiwModifyStyle(
        __ESIS_STH_PIXEL     // IMPORTANT: horizontal scrolling strategy
            |__ESIS_STV_ITEM // IMPORTANT: vertical scrolling strategy
            |__EGBS_FIXED_SIZE_ROWS
            |__EGBS_SFB_FULL_ROWS
            |__EGBS_GRIDLINES
            |__EGBS_NO_HIDE_SELECTION,
        0,
        false
        );
    OuterRowCountTopSet( 2 );
    ColumnAdd( 5, false );
    int  i, j;
    for( i = 0; i < 5; i++ )
    {
        CExtGridCell* pCell =
            GridCellGetOuterAtTop(
                i,
                0,
                RUNTIME_CLASS(CExtGridCellHeader)
                );
        pCell->TextSet("X");
        pCell->ModifyStyle(__EGCS_TA_HORZ_CENTER);
        pCell->ExtentSet(80);
    }
    RowAdd( 5, false );
    CExtGridCellVariant * pDataCell;
    for( i = 0; i < RowCountGet(); i++ )
    {
        for( j = 1; j < ColumnCountGet(); j++ )
        {
            pDataCell =
                STATIC_DOWNCAST(
                    CExtGridCellVariant,
                    GridCellGet(
                        j,
                        i,
                        0,
                        0,
                        RUNTIME_CLASS(CExtGridCellCurrency)
                        )
                    );
            pDataCell->ModifyStyle( __EGCS_NO_INPLACE_CONTROL );
            pDataCell->_VariantAssign( 0.0 );
        }
    }
    OnSwUpdateScrollBars();
}

Sergio Del Valle Apr 24, 2006 - 4:10 PM

Hi again,

I’m now having problems when selecting a row for which I need to scroll down the grid, if it’s my first selection it works fine, but when I select a visible row and then scroll down and select the last row it doesn’t highlight the selected row.

Thanks again for your help.

Technical Support Apr 25, 2006 - 11:31 AM

Would you send us the current version of the project so we can find out what’s wrong?

Sergio Del Valle Apr 25, 2006 - 1:03 PM

Sending you the current project is a bit difficult since it depends on a database which I cannot send you, anyway I’m gonna try to reproduce this behaviour in a new project and send it to you.