BAP Online Manuals : Library Reference : Library by Name : menubar
Previous: member
Next: messagebox

6.2.84. menubar

adds a menu bar to a window

SYNOPSIS

INCLUDE 'winlib'
menubar(Win, MyId, Menulist, Handle)

SYNTAX

menubar(Win, Id, List, Handle) (i,i,i,o)

ARGUMENTS

integer(Win) (i) Handle of the parent window.
void(Id) (i) Id of the process receiving messages.
voidlist(List) (i) List of menu items.
integer(Return) (o) Handle of the created menu.

DESCRIPTION

This predicate creates a menu bar in the Simple Window or graphics window referred to by Win. Id is the process id of the receiver of the menu messages.
The item list consists of menuitems of the form:
Identifier, options, text
or popup menus:
text(itemlist)

Identifier is an integer used to return the selection of the item, options is one of the constants defined in winlib.h or 0, text is a string containing the menu item itself. A & before a letter in text allows selection by keystroke.
A popup menu item contains another menu as argument of its struct body. The struct's functor is the title of the popup.

Selection of a menu item by the user results in a message of the form

ret(menu(X))

being sent to the process identified by 'Id', where X is the selected item's identifier.

Note: The exact implementation is host server dependent. Menus are handled similarly on most windows systems, but details may differ.

EXAMPLE

gotowindow(Win),
get_my_id(Id),
menubar(Win, Id, ['&File'([ 	1,0,'&Open'
			2,mf_grayed,'&Close',
			3,0,'&Print',
			0,mf_separator,' ',
			4,0,'E&xit']),
		30,0,'&Help'],_),
rec_msg(_,ret(menu(X))),
domenu(X),
killmenu(Win).

ERRORS

No runtime errors

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

killmenu , gotowindow , servertype , get_my_id


BAP Online Manuals : Library Reference : Library by Name : menubar
Previous: member
Next: messagebox