Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>appendmenu()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
AppendMenu()
Add a menu item to a menu
------------------------------------------------------------------------------

Syntax
AppendMenu( <aMenu>, <cId>, <nFlags>, <cPrompt>,
            [ <bAction> | <aPopupMenu> ] )   -->   lSuccess

Arguments
<aMenu> is the existing menu, originally obtained from
CreateMenu() or CreatePopupMenu().

<cId> is a character string identifying the item being added
to the menu.  Any string convenient to the application may be
used.  If the user chooses this menu item, this <cId> will be
passed to the <bAction> code block.

<nFlags> specifies the type of menu item being added.  Use a
combination of the MF_* values defined in WINDOWS.CH, which
are explained below.

<cPrompt> is the item to display.  For the special case of
MF_BITMAP, this item must be a handle to a bitmap.

<bAction> is an optional code block to be executed if the user
chooses this menu item.

<aPopupMenu> is an optional parameter specifying a sub-menu.
This must be a pop-up menu originally returned by
CreatePopupMenu().

Returns
If successful, logical TRUE (.T.) is returned, otherwise FALSE
(.F.) is returned.

Description
This function is used to add an item to an existing menu
structure, which can be activated using SetMenu().  This array
should not be altered or examined, and is subject to change in
future versions of Clip-4-Win.

If the user chooses this menu item, the code block is run, and
is passed two parameters:  the <cId> and the <aMenu> itself.

The <nFlags> value is a combination of the following:

   value            meaning

MF_BITMAP           the item is a bitmap (and <cPrompt> must be the
                    bitmap handle)

MF_CHECKED          adds a check mark to the item

MF_DISABLED         stops the menu item being selected (if visible,
                    it will not be grayed unless MF_GRAYED is used)

MF_ENABLED          allows the menu item to be selected

MF_GRAYED           stops the menu item being selected
                    (also, if visible, it will be grayed)

MF_MENUBARBREAK     like MF_MENUBREAK, but uses a vertical line to
                    separate the new and old columns (in a pop-up menu)

MF_MENUBREAK        starts a new line for a top-level menu item, or a new
                    column (with no separating vertical line) for a
                    pop-up menu

MF_POPUP            the item is a pop-up menu

MF_SEPARATOR        displays as a horizontal line; only applies to
                    a pop-up menu item

MF_STRING           marks the item as a character string (as opposed to
                    MF_POPUP, for example)

MF_UNCHECKED        does not add a check mark to the menu item
                    (this is the default)

Example
// The famous File...Exit menu
aMenu = CreateMenu()
aPopupMenu = CreatePopupMenu()
AppendMenu( aPopupMenu, "exit", MF_ENABLED + MF_STRING,     ;
            "E&xit", {|cId, aMenu| DoExit()} )
AppendMenu( aMenu, "file", MF_ENABLED + MF_POPUP,           ;
            "&File", aPopupMenu )
SetMenu( hWnd, aMenu )


See Also: CreateMenu() CreatePopupMenu() GetMenuItemCount() SetMenu()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson