Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
class CButton
◄CWnd►                                        ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  Description
 
  The CButton class provides the functionality of Windows button control.
  A button control is a small, rectangular child window that can be
  clicked on and off. Buttons can be used alone or in groups, and can
  either be labeled or appear without text. A button typically changes
  appearance when the user clicks it.
 
  Typical buttons are the check box, radio button, and pushbutton. A
  CButton object can become any of these, according to the ◄style►
  specified at its initialization by the ◄Create► member function.
 
  You create a button control in two steps. First, call the constructor
  CButton to construct the CButton object, then call the ◄Create► member
  function to create the Windows button control and attach it to the
  CButton object.
 
  Construction can be a one-step process in a class derived from CButton.
  Write a constructor for the derived class and call Create from within
  the constructor.
 
  If you want to handle the Windows notification messages sent by a
  CButton object to its parent (usually a class derived from CDialog or
  CModalDialog), add the appropriate message-map entries and
  message-handler member functions to the parent class to handle the
  messages you want to process. Potential message-map entries are:
 
  ON_COMMAND
  ON_BN_CLICKED
  ON_BN_DOUBLECLICKED
 
  If you create a CButton object within a dialog box (through a dialog
  resource), the CButton object is automatically destroyed when the user
  closes the dialog box.
 
  If you create a CButton object within a window, you may also need to
  destroy it. If you create the CButton object on the stack, it is
  destroyed automatically. If you create the CButton object on the heap by
  using the new function, you must call delete on the object to destroy it
  when the user closes the Windows button control.
 
  If you allocate any memory in the CButton object, override the CButton
  destructor to dispose of the allocations.
 
  See Also
 
  ◄CWnd►, ◄CComboBox►, ◄CEdit►, ◄CListBox►, ◄CScrollBar►, ◄CStatic►,
  ◄CModalDialog►, ◄CDialog►
 
  Public Members
 
  Construction/Destruction
 
  ◄CButton►   Constructs a CButton object.
 
  Initialization
 
  ◄Create►   Creates the Windows button control and attaches it to the
             CButton object.
 
  Operations
 
  ◄GetState►         Retrieves the state of a button control.
 
  ◄SetState►         Sets the highlighting state of a button control.
 
  ◄GetCheck►         Retrieves the check state of a button control.
 
  ◄SetCheck►         Sets the check state of a button control.
 
  ◄GetButtonStyle►   Retrieves information about the button control
                     style.
 
  ◄SetButtonStyle►   Changes the style of a button.
 
 
                                     -♦-