[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Main menu
----------------------------------------------------------------------------
The typical structure of a Windows program is to build a Window and to
assign it a main menu that will be useful as main organizer of the
application.
From the menu, the user can select the different tasks of a program.
Thanks to the pulldown menu structure of Windows we can implement an
easy and intuitive user interface.
You should try to use good design techniques for the main
menu of your application. Don't make it too complicated. The idea is to
implement just a few main options at the bar menu so the user will easily
select what he needs, and from there you should presents new submenus that
will contain all the possible options.
FiveWin has been designed so you don't need to code DO CASE...ENDCASE
options to select from the different actions the user may choose.
When a MenuItem is defined we will specify the action we want to be
automatically executed when the user selects that option. It is very
easy to control all the possible options of the program.
MENU oMenu
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction>
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction>
MENU
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction>
ENDMENU
...
SEPARATOR
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction>
ENDMENU
MESSAGE & ACTION are optional clauses. While it is not necessary
to specify them, they may be desirable. If an Action clause is not defined,
then simply nothing happens when you select that menu option.
You should have as many SubMenus as you need. To create a SubMenu you
should only have to specify a new declaration MENU ... ENDMENU
under a MenuItem and complete it as usual.
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction>
MENU // The new Submenu starts here
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction>
...
ENDMENU
MENUITEM <cItem> MESSAGE <cMessage> ACTION <uAction> // More Items
To activate the menu:
To activate the menu first you have to assign it to a Window. The easiest
way to do it is when we are building our Window:
DEFINE WINDOW <oWnd> <otherClauses> ;
MENU BuildMenu()
...
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM <cItem> MESSAGE <cMessage> ...
...
ENDMENU
return oMenu
or you can do it later using the command:
SET MENU OF <oWnd> TO <oMenu>
See Also:
TMenu
Commands
Menu.ch
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson