|
|
|
|
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.
Subject |
Author |
Date |
|
Luis Alberto Pereira
|
Mar 14, 2004 - 7:11 PM
|
Dears, How can I hold a specific dialog/window in a ellipsis button in grid control ? Regards, Luis Alberto<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
|
|
Technical Support
|
Mar 15, 2004 - 6:55 AM
|
Dear Luis, To display your dialog when the ellipsis button is clicked, you should use your own grid cell class and override the CExtGridCell::OnButtonPressed() virtual method. Here is a sample:
class CMyCell : public CExtGridCellStringDM
{
public:
// runtime type info that required for grid cells
DECLARE_DYNCREATE( CMyCell );
IMPLEMENT_ExtGridCell_Clone(
CMyCell, CExtGridCellStringDM );
// constructor
CMyCell (
CExtGridDataProvider * pDataProvider = NULL
)
: CExtGridCellStringDM( pDataProvider )
{
}
// handle the cell button clicks
void OnButtonPressed(
CExtGridWnd & wndGrid,
INT nButtonType,
const RECT & rcCellExtra,
const RECT & rcCell,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType
)
{
ASSERT_VALID( this );
ASSERT_VALID( (&wndGrid) );
if( nButtonType != __EBTT_ELLIPSIS )
{ // if not an ellipsis button pressed
CExtGridCellStringDM::
OnButtonPressed(
wndGrid,
nButtonType,
rcCellExtra,
rcCell,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType
);
return;
} // if not an ellipsis button pressed
// update cell
wndGrid.InvalidateRect( &rcCellExtra );
wndGrid.UpdateWindow();
// display your dialog here:
CYourDialog dlg( &wndGrid );
dlg.DoModal();
}
}; // class CMyCell
// runtime type info that is required for grid cells
IMPLEMENT_DYNCREATE( CMyCell, CExtGridCellStringDM );
Now, you should use your cells in the grid control instead of Prof-UIS cell types. Initially grid control does not contain CExtGridCell objects. To insert your cell at the specified location, you may use following code:
CExtGridCell * pCell =
m_wndGrid.GridCellGet(
nColNo, nRowNo, 0, 0,
RUNTIME_CLASS(CMyCell )
);
// pCell should point to an object of CMyCell if this
// position previously haven’t had a cell at all
|
|