<< Return to Main Index

< Return to Class Index

CGXGridCore::AddCommand

void AddCommand(CGXCommand* pCmd, GXCmdType ctCmd);?

pCmd

Points to the command being added.

ctCmd

Specifies if the executed command is undone (gxUndo), redone (gxRedo) or executed the first time (gxDo).

Remarks

Inserts the command-object either into the redo-stack if the current command is undone or otherwise into the undo-stack.

Control-Factory Specific ->

This method has been implemented using the abstraction mechanism as discussed in the chapter "Reducing the size of your application" in the user's guide. A call to the ImplementUndoRedo method from within the control factory class' InitializeGridComponents method will make the concrete implementation of this method available to your application.

If no concrete implementation is available this method performs no action. A warning will be displayed in the debug window.

END Control-Factory Specific

Example

This example illustrates the usage of AddCommand:

BOOL CGXGridCore::SetDefaultColWidth(int nWidth, UINT flags /*= GX_UPDATENOW*/, GXCmdType ctCmd /*=gxDo*/)
{
   int nOldWidth = GetDefaultColWidth( );

   if (StoreDefaultColWidth(nWidth))
   {
      UpdateChangedColWidths(1, GetColCount( ), NULL, flags, TRUE);

       if (ctCmd != gxRollback && m_pParam->m_bUndoEnabled)
         AddCommand(new CGXSetDefaultColWidthCmd(nOldWidth), ctCmd);

      return TRUE;
   }
   return FALSE;
}

CGXGridCore

Class Overview | Class Members