<< Return to Main Index

< Return to Class Index

CGXControl::OnCommand

virtual BOOL OnCommand();

Return Value

TRUE if the command has been processed; FALSE if the command should be handled by the gridview or window.

Remarks

This method is called when the grid receives a WM_COMMAND message (e.g., CBN_SELCHANGE). The grid passes the attributes of the WM_COMMAND message to this method.

Override this method if you want to process notification messages in a control, such as EN_CHANGE or CBN_SELCHANGE (see example).

Example

This example shows how to handle combo box notification messages if you have subclassed a CGXComboBoxWnd control.

BOOL COwnerDrawnComboBox::OnCommand(WPARAM wParam, LPARAM lParam)
{
#if _MFC_VER < 0x0300
   UINT nNotification = HIWORD(lParam);
   HWND hCtl = (HWND) LOWORD(lParam);
#else
   UINT nNotification = HIWORD(wParam);
   HWND hCtl = (HWND) lParam;
#endif

   if (hCtl == m_hWnd)     // is it really this wnd?
   {
      if (nNotification == CBN_SELCHANGE
         || nNotification == CBN_EDITCHANGE)
      {
         TRACE("Combobox changed\n");
      }
   }

   return CGXComboBoxWnd::OnCommand(wParam, lParam);
}

See Also

CGXControl::OnModifyCell

CGXControl

Class Overview | Class Members