MenuItem Object
Parents Children Properties Methods Events
Purpose: This object allows the user to initiate an action or to select an option from a menu.

Description

The Caption property determines the text string that is displayed in its parent as the menu option. The size of a MenuItem is determined by the size of its Caption, or by the size of the largest object (Menu, MenuItem or Separator) with the same parent. The position of the MenuItem is normally determined by the order in which it is created in relation to other objects with the same parent. However, you can use the Posn property to insert a new MenuItem into an existing structure. For example, having defined three MenuItem objects as children of a Menu, you can insert a fourth one between the first and the second by specifying its Posn to be 2. Note that the value of Posn for the MenuItems that were previously second and third will then be reset to 3 and 4 respectively.

The Style property may be 'Check' (the default) or 'Radio'. Style determines the type of graphic displayed alongside the Caption if the MenuItem is checked.

The Checked property is a single number with the value 0 or 1. 0 means not checked (the default), 1 means checked and a tick mark or radio dot is placed alongside its Caption. This property is frequently used to indicate which of a choice of options is currently set.

If a MenuItem is a child of a MenuBar which is itself a child of a Form or SubForm, the Align property can be set to 'Right'. This is used to position a single MenuItem (or Menu) at the rightmost end of a MenuBar. This does not apply if the MenuBar is owned by a ToolControl.

If you set the EdgeStyle property to 'Plinth', the MenuItem will take on an appearance that is similar to a pushbutton and be raised when not selected and recessed when selected. Note that to enable 3-dimensional appearance, you must set EdgeStyle to something other than 'None' for all the objects above the MenuItem in the tree.

The BtnPix property is used to display a picture in a MenuItem. BtnPix specifies the names of, or refs to, three Bitmap objects. The first Bitmap is displayed when the MenuItem does not have the focus (normal), the second when it does have the focus (highlighted). The third Bitmap is displayed when the MenuItem is made inactive (Active property is 0). If Caption is also defined, it is displayed on top of the bitmaps.

Alternatively, you may display an image alongside the Caption using the ImageIndex property. This selects a picture from the ImageList associated with the ImageListObj property of the parent Menu.

EdgeStyle, BtnPix, FontObj, FCol and BCol are not effective if the MenuItem is the direct child of a MenuBar.

A MenuItem generates a Select event (if enabled) when the user chooses it.