| **Navigation:**  [[introduction.htm|Language Reference]] > 8 - Controls <; Control Declarations > ====== ITEM (declare a menu item) ====== | [[image declare a graphic image control .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[line declare a line control .htm|{{btn_next_n.gif|Next page}}]] | | || {{newc7.jpg|NewC7.jpg}} | **ITEM(**//text//**)** | [,**AT( )** ] [,**USE( )**] [,**KEY( )**] [,**MSG( )**] [,**HLP( )**] [,**STD( )**] [,**CHECK**] [,**DISABLE**] [,**COLOR**] [,**LEFT( )**] [,**HIDE**] | | | [,**SEPARATOR**][,**ICON( )**] [,**FONT( )**] | [,| **FIRST**| ] | | | | | **LAST**| | {{blk2blue.jpg|blk2blue.jpg}} | **ITEM** | Declares a menu choice within a MENUBAR or MENU structure. | | //Text// | A string constant containing the display text for the menu item (PROP:Text). | | **AT** | Specifies the width and height of the menu item (PROP:AT). If omitted, default values are selected by the runtime library. The first two parameters of the AT attribute are ignored. The fixed width specified by the AT attribute includes (and therefore must be greater than) the text offset specified by the LEFT attribute. The specified width of the area to draw the item can be less than the width of the default area provided by Windows, and the runtime library uses the full width of the specified area. | | **USE** | A field equate label to reference the menu item in executable code, or the variable used with CHECK (PROP:USE). | | **KEY** | Specifies an integer constant or keycode equate that immediately executes the menu item (PROP:KEY). | | **MSG** | Specifies a string constant containing the text to display in the status bar when the menu item is highlighted (PROP:MSG). | | **HLP** | Specifies a string constant containing the help system identifier for the menu item (PROP:HLP). | | **STD** | Specifies an integer constant or equate that identifies a "Windows standard action" the menu item executes (PROP:STD). | | **CHECK** | Specifies an on/off ITEM (PROP:CHECK). | | **DISABLE** | Specifies the menu item appears dimmed when the WINDOW or APPLICATION is first opened (PROP:DISABLE). | | **COLOR** | Specifies the background, foreground, and selected color for the menu item control.(see.[[color set color .htm|COLOR]]) | | **LEFT** | Specifies the offset in dialog units from the left edge of the menu structure. | | **HIDE** | Specifies the ITEM does not appear when the WINDOW or APPLICATION is first opened (PROP:HIDE). UNHIDE must be used to display it. | | **SEPARATOR** | Specifies the ITEM displays a solid horizontal line across the menu box at run-time to delimit groups of menu selections. The USE attribute may be specified with SEPARATOR. | | **ICON** | Specifies an image file or standard icon to display on the menu item (PROP:ICON). | | **FONT** | Specifies the display font for the control (PROP:FONT). | | **FIRST** | Specifies the ITEM appears at the top of the menu when menus are merged (PROP:FIRST). | | **LAST** | Specifies the ITEM appears at the bottom of the menu when menus are merged (PROP:LAST). | **ITEM** declares a menu choice within a MENUBAR or MENU structure. The //text// string may contain an ampersand ( & ) which designates the following character as an accelerator "hot" key which is automatically underlined. If the ITEM is on the menu bar, pressing the Alt key together with the accelerator key highlights and executes the ITEM. If the ITEM is in a MENU, pressing the accelerator key, alone, when the menu is displayed, highlights and executes the ITEM. If there is no ampersand in the //text//, the first non-blank character in the //text// string is the accelerator key for the ITEM, which will not be underlined. To include an ampersand as part of the //text//, place two ampersands together (&&) in the //text// string and only one will display. The KEY attribute designates a separate "hot" key for the item. This may be any valid Clarion keycode to immediately execute the ITEM's action. A cursor bar highlights individual ITEMs within the MENU structure. Each ITEM is usually associated with some code to be executed upon selection of that ITEM, unless the STD attribute is present. The STD atribute specifies a standard Windows action the menu item performs, such as Tile or Cascade the windows. The SEPARATOR attribute creates an ITEM which serves only to delimit groups of menus selections so it should not have a //text// parameter. The USE attribute may be used with a SEPARATOR. It creates a solid horizontal line across the menu box. An ITEM that is not within a MENU structure is placed on the menu bar. This creates a menu bar selection which has no related drop-down menu. The normal convention to indicate this to the user is to terminate the //text// displayed for the item with an exclamation point (!). For example, the //text// for the ITEM might contain 'Exit!' to alert the user to the executable nature of the menu choice. A two-column drop menu can be achieved by assigning PROP:Max = 1 to the ITEM which should begin the second column. **Events Generated:** | EVENT:Accepted | The control has been pressed by the user. | **Example:** MainWin APPLICATION('My Application'),SYSTEM,MAX,ICON('MyIcon.ICO'),STATUS,HVSCROLL,RESIZE     MENUBAR      ITEM('E&xit!'),USE(?MainExit),FIRST      MENU('File'),USE(?FileMenu),FIRST       ITEM('Open...'),USE(?OpenFile) ,HLP('OpenFileHelp') ,FIRST       ITEM('Close'),USE(?CloseFile),HLP('CloseFileHelp'),DISABLE       ITEM('Auto Increment'),USE(ToggleVar),CHECK      END      MENU('Edit'),USE(?EditMenu),KEY(CtrlE),HLP('EditMenuHelp')       ITEM('Undo'),USE(?UndoText),KEY(CtrlZ),STD(STD:Undo),DISABLE       ITEM,SEPARATOR       ITEM('Cu&t'),USE(?CutText),KEY(CtrlX),STD(STD:Cut),DISABLE       ITEM('Copy'),USE(?CopyText),KEY(CtrlC),STD(STD:Copy),DISABLE       ITEM('Paste'),USE(?PasteText),KEY(CtrlV),STD(STD:Paste),DISABLE      END      MENU('Window'),STD(STD:WindowList),MSG('Arrange or Select Window'),LAST        ITEM('Tile'),STD(STD:TileWindow)        ITEM('Cascade'),STD(STD:CascadeWindow)        ITEM('Arrange Icons'),STD(STD:ArrangeIcons)        ITEM,SEPARATOR,USE(?FileSeparator1)      END      MENU('Help'),USE(?HelpMenu),LAST,RIGHT        ITEM('Contents'),USE(?HelpContents),STD(STD:HelpIndex)        ITEM('Search for Help On...'),USE(?HelpSearch),STD(STD:HelpSearch)        ITEM('How to Use Help'),USE(?HelpOnHelp),STD(STD:HelpOnHelp)        ITEM('About MyApp...'),USE(?HelpAbout),MSG('Copyright Info'),LAST      END     END !Menubar    END  !Application See Also: [[menubar_declare_a_pulldown_menu_.htm|Menubar]] [[menu_declare_a_menu_box_.htm|Menu]]