virtual BOOL ChangeProperties(const CGXProperties& properties, UINT nFlags = GX_UPDATENOW, GXCmdType ctCmd = gxDo);
properties
A reference to the property object with the new settings. The settings will be copied to the property object that is attached to the grid.
nFlags
GX_INVALIDATE - invalidates the window
ctCmd
Specifies if the executed command is undone (gxUndo), redone (gxRedo), executed the first time (gxDo) or rolled back (gxRollback).
TRUE if the command has been successfully executed; it is FALSE if the command failed.
Call this method if you want to reinitialize the property object, for example after you have displayed the CGXDisplayPropertiesDialog and the user did make changes. The user will be able to undo these changes.
Here is how you should open the properties dialog and then apply the changes to the grid.
void CMyGridView::OnViewProperties()
{
BOOL bSaveDefault = FALSE;
CGXProperties* pPropertyObj = GetParam()->GetProperties();
ASSERT(pPropertyObj->IsKindOf(RUNTIME_CLASS(CGXProperties)));
CGXProperties* pNewSettings = new CGXProperties;
*pNewSettings = *pPropertyObj;
CGXDisplayPropertiesDialog dlg(pNewSettings, GetParam()->GetStylesMap(), &bSaveDefault, FALSE);
int result = dlg.DoModal();
if (result == IDOK)
{
ChangeProperties(*pNewSettings);
if (bSaveDefault)
pPropertyObj->WriteProfile();
Redraw();
}
delete pNewSettings;
}
See the sample file mygridvw.cpp in gridapp for displaying a dialog that lets the user change header/footer and page setup settings.
CGXDisplayPropertiesDialog CGXProperties
Class Overview | Class Members