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>insertmenu()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
InsertMenu()
Insert a menu item into a menu
------------------------------------------------------------------------------

Syntax
InsertMenu( <aMenu>, <cOldId>, <cNewId>, <nFlags>, <cPrompt>,
            [ <bAction> | <aPopupMenu> ] )   -->   lSuccess

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

<cOldId> is a character string identifying the menu item
before which the new one is to be inserted.

<cNewId> 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
<cNewId> 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.

<cPrompt> is the item to display.

<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 insert an item into 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 menu has already been
activated using SetMenu(), the DrawMenuBar() function should
be called after InsertMenu().

Example
// The famous File...Exit menu
aMenu = CreateMenu()
aPopupMenu = CreatePopupMenu()
AppendMenu( aPopupMenu, "exit", MF_ENABLED + MF_STRING,     ;
            "E&xit", {|cId| DoExit()} )
// it's easier to use AppendMenu(), but ...
InsertMenu( aPopupMenu, "exit", "save",                     ;
            MF_ENABLED + MF_STRING,                         ;
            "&Save", {|cId, aMenu| DoSave( cId )} )
AppendMenu( aMenu, "file", MF_ENABLED + MF_POPUP,           ;
            "&File", aPopupMenu )
SetMenu( hWnd, aMenu )


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

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