SECMenuButton Class

class SECMenuButton: public SECBitmapButon

The SECMenuButton class provides a simple button which when clicked displays a popup menu. This popup menu can be displayed either to the right or below the button (See Direction). SECMenuButton attaches to existing CButton controls and will pop up a given menu whenever the button is clicked.

Defined in: SECBTNS.h

Comments

To use SECMenuButton, follow this procedure:

1. Attach SECMenuButton to an existing CButton using the AttachButton member function.
2. Specify the handle of the popup menu.
3. Specify where to place the popup menu (below or to the right of the button).

You can dynamically create an SECMenuButton using the Create function. Note that the menu handle must exist for the life of the SECMenuButton object.

See the COLOR sample in the \\OT\\SAMPLES\\STANDARD\\CONTROLS\\COLRWELL directory for a demonstration of this class.

enum  Direction

Direction constants

Class Members

Creation/Initialization

 SECMenuButton()

Creates a menu button object.

virtual BOOL  AttachButton(int nCtlID, CWnd* pParentWnd, HMENU hMenu, Direction direction=DT_Down, int iFlags=0)

Attaches the menu button object to an existing button.

virtual BOOL  Create(LPCTSTR lpszCaption, DWORD dwStyle, const CRect& rect, CWnd* pParentWnd, int nID, HMENU hMenu, Direction direction=DT_Down, int iFlags=0)

Dynamically creates a menu button control.

Attributes

void  SetDirection(Direction direction)

Sets the direction of the arrow on the button.

Direction  GetDirection() const

Gets the direction of the arrow on the button.

Operations

void  SetMenu(HMENU hMenu)

Sets the popup menu.

Overridable

virtual void  OnBnClicked()

Called when the button is clicked (to create popup menu)

virtual SECBitmapButton::Alignment  Initialise(LPCTSTR lpszCaption, HMENU hMenu, Direction direction, UINT& nIDBmp)

Performs object initialisation.

virtual void  DrawItem(LPDRAWITEMSTRUCT lpDS)

Draws the button.

Protected data members

CMenu  m_menu

The popup menu.

Direction  m_direction

Direction of arrow (down or right).

BOOL  m_bAllowDraw

When FALSE, the button is not drawn.