Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Artful Two for Clipper 5.0 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

Syntax

PD_MENU( bBlock )

Purpose

Creates a pulldown menu system according to SAA conventions.

Arguments

     bBlock -- a code block which returns an array of "menu objects".
                   Each menu object consists of a prompt string and an
                   array containing its submenu. Menus and submenus have
                   identical structures. The only difference between them
                   is their location in the menu tree.

Setup

Create a builder function which creates all your menus, optionally sets
wrap on or off, and optionally assigns a colour specification.

Create a code block which calls the builder function (e.g., {||MYUDF()}).

To create a menu, use the function PD_CREATE(). To add a menu either to the
menu bar (i.e. main menu) or to a parent menu, use the function
PD_ADDMENU(). Create all the menus desired, then build them upwards using
PD_ADDMENU().

At the end of the process you'll have a series of "main menus", which then
must be added to the menu bar. You may then either add each menu to the
menu bar using PD_ADDMENU(), or add them all at once by calling
PD_BECOME(), passing it an array of menus.

The final step is to call PD_MENU(), passing it the code block.

PD_MENU() respects the current WRAP setting. If no colours
are defined, it uses the current colour settings.

Notes

Alternate keys activate the menu bar. Any character within a menu option
may be designated its activator by preceding the character with a tilde
(~). Activators appear in highlighted colour. Any number of submenus may be
added, although the screen will realistically only permit about three
levels. On completion or cancellation of any menu choice, the menu bar
becomes inactive. This may not be to your liking, but it is SAA-compatible.

Example

     LOCAL bMyBlock := { || MYMENU() }
     PD_MENU( bMyBlock )

     FUNCTION MYMENU
     LOCAL aPullDown
     LOCAL bTestBlock := {|| POP_MSG("This is a test")}
     LOCAL aFileMenu := ;
       PD_CREATE( "~File", ;
                  { { "~New   ", bTestBlock }, ;
                    { "~Delete ", bTestBlock }, ;
                    { "E~xit  ", {||QUITPROG()} } ;
                  } ;
                )

     <... more menus...>

     RETURN PD_BECOME( { aFileMenu, a2ndMenu, ...} )

See AADP.PRG in the apps directory for a working example of PD_MENU().

Returns

NIL.

Side Effects

The menu object must be correctly structured or the function will crash.

Artful Calls

PD_BECOME, PD_CREATE

@SECTION = Dependencies

This PD_MENU() is not compatible with Artful v1.xx's functio of the
same name. It takes advantage of CLIPPER 5.0 features, and is
SAA-compatible.

PD_MENU() relies on code supplied with CLIPPER 5.0 in OMENU.PRG, STRING.PRG
and ARRAY.PRG, copyright Nantucket Corporation, 1990. To minimise linking
inconvenience we have placed compiled object modules of these in OMENU.LIB,
and included that library in the Artful link lists.

We recommend that you read Craig Ogg's OMENU.PRG.

Source File

AA_PDMNU.PRG, OMENU.PRG

See Also: PD_BECOME() PD_CREATE()

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