| superclass(es) |
object |
| subclass(es) |
popupMenu |
| description |
The menu class can be used for creating and manipulating a menu of a frame
window or a popupmenu. |
| remarks |
Under windows it is not possible to put a checkmark besides a menu item
that is part of the top menubar of a frame window, top menu items can only be enabled and
disabled. |
| see also |
frame |
Each menu item is identified by an unique
identifier, if the menu is selected or clicked by the user an event is executed
with the identifier of the menu item as a parameter.
If a menu item is appended or inserted then the initial state
of the menu item can specified by using of the four predefined constants, these constants
are:
enabled_unchecked; a normal menu item
disabled_unchecked; a disabled menu item, usually the textcolor of
the item is gray
enabled_checked; a checkmark appears on the menu item
disabled_checked; a disabled menu item with a checkmark
The top menubar of a frame is also a menu, if a the user clicks on an item
another menu opens, this is a submenu. Each submenu is also an instance of the class menu.
Creating and populating a menu is usually done by first creating a menu for the top
menubar, then for each submenu separate menu instances are created and populated with menu
items. The last step is to insert the submenus into the top menu and to assign the top
menu instance to the frame (putMenu/2). |
appendItem(Id, Name)
| func |
Append a menu item to the frame window. |
| pre |
The Id variable must contain an integer, this integer will be used to
identify which menu item was clicked during the processing of an onCommand
event handler of a window. The Name variable must contain the text that appears inside the
menu item. |
| post |
If the menu item was successfully created the method was exited
successfully, else the method failed. |
 |
State constants |
appendItem(Id, Name, State)
| func |
Append a menu item to the frame window. |
| pre |
The Id variable must contain an integer, this integer will be used to
identify which menu item was clicked during the processing of an onCommand
event handler of a window. The Name variable must contain the text that appears inside the
menu item. The State variable must contain one of the following four values:
enabled_unchecked, disabled_unchecked, enabled_checked or disabled_checked. |
| post |
If the menu item was successfully created the method was exited
successfully, else the method failed. |
 |
State constants |
appendItem(Id, Name, State, PosOutput)
| func |
Append a menu item to the frame window. |
| pre |
The Id variable must contain an integer, this integer will be used to
identify which menu item was clicked during the processing of an onCommand
event handler of a window. The Name variable must contain the text that appears inside the
menu item. The State variable must contain one of the following four values:
enabled_unchecked, disabled_unchecked, enabled_checked or disabled_checked. |
| post |
If the menu item was successfully created then PosOutput was assigned the
position of the new menu item, if there was an error then -1 was assigned to PosOutput. |
 |
State constants |
insertItemBefore(Id, Name, Pos, State, Output)
| func |
Insert a menu item into the menu at a specified position, the first menu
item has position 0. |
| pre |
The Id variable must contain an integer, this integer will be used to
identify which menu item was clicked during the processing of an onCommand event handler
of a window. The Name variable must contain the text that appears inside the menu item.
The Pos variable must contain an integer, the first menu item has position 0. The State
variable must contain one of the following four values: enabled_unchecked,
disabled_unchecked, enabled_checked or disabled_checked. |
| post |
If the menu item was successfully created then Output is assigned the
value true, else it was assigned false. |
 |
State constants |
appendSeparator
| func |
Append a separator menu item to the menu. A separator menu item contains
no text and has no identifier and it appears as a menu item with a gray line inside it. |
| pre |
TRUE. |
| post |
The method was exited successfully if the separator was appended, else the
method failed. |
appendSeparator(Output)
| func |
Append a separator menu item to the menu. A separator menu item contains
no text and has no identifier and it appears as a menu item with a gray line inside it. |
| pre |
TRUE. |
| post |
Output was assigned true if the menu item was appended, else it was
assigned false. |
deleteItem(Id, Output)
| func |
Delete a menu item which is identified by the value of the variable ID. |
| pre |
The variable Id must contain an integer specifying the identifier of a
menu item. |
| post |
Output was assigned true if the menu item was deleted, else it was
assigned false. |
 |
The method delete cannot be used to remove a menu
item |
deleteItemAtPos(Pos, Input)
| func |
Delete a menu item which is positioned at the value of variable Pos, the
position of the first menu item is 0. |
| pre |
The variable Pos must contain an integer specifying the position of a menu
item. |
| post |
Output was assigned true if the menu item was deleted, else it was
assigned false. |
enableItem(Id, YesNo)
| func |
Enable or disable a menu item. |
| pre |
The variable Id must contain an integer specifying the identifier of a
menu item. YesNo must contain true or false. |
| post |
If YesNo contained true then the menu item was enabled, else it was
disabled. |
enableItemAtPos(Pos, YesNo)
| func |
Enable or disable a menu item at a specified position. The index of a
first menu item is 0. |
| pre |
The variable Pos must contain an integer specifying the position of a menu
item. YesNo must contain true or false. |
| post |
If YesNo contained true then the menu item was enabled, else it was
disabled. |
checkItem(Id, YesNo)
| func |
Add or remove a checkmark of a menu item. |
| pre |
The variable Id must contain an integer specifying the identifier of a
menu item. YesNo must contain true or false. |
| post |
If YesNo contained true then a checkmark was added, else a checkmark was
removed. |
enabled(Id, Output)
| func |
Determine if a menu item is enabled or disabled. |
| pre |
The variable Id must contain an integer specifying the identifier of a
menu item. |
| post |
The value of Output was assigned true if the menu item was enabled, else
the variable Output was assigned false. |
checked(Id, Output)
| func |
Determine if a menu item has a checkmark or not. |
| pre |
The variable Id must contain an integer specifying the identifier of a
menu item. |
| post |
The value of Output was assigned true if the menu item has a checkmark,
else the variable Output was assigned false. |
giveString(Pos, Output)
| func |
Get the string of a menu item. |
| pre |
The variable Pos must contain an integer specifying the position of a menu
item. The position of the first menu item is 0. |
| post |
The value of Output was assigned the string of the menu item. |
giveId(Pos, Output)
| func |
Get the identifier of a menu item. |
| pre |
The variable Pos must contain an integer specifying the position of a menu
item. The position of the first menu item is 0. |
| post |
The value of Output was assigned the identifier of the menu item. |
givePos(Id, Output)
| func |
Get the position of a menu item. |
| pre |
The variable Id must contain an integer specifying the identifier of a
menu item. |
| post |
The value of Output was assigned the position of the menu item. If the
identifier was not found then Output was assigned -1. |
| remarks |
The position of the first menu item is 0. |
contains(Output)
| func |
Get the number of menu items that a menu has. |
| pre |
TRUE. |
| post |
The value of Output was assigned the number of items in the menu. |
append(SubMenu, Name)
| func |
Append a submenu to a menu. |
| pre |
The SubMenu variable must refer to a menu instance. The Name variable must
contain the name of the menu item. |
| post |
If the submenu was appended then the method was exited successfully, else
it failed. |
append(SubMenu, Name, PosOutput)
| func |
Append a submenu to a menu. |
| pre |
The SubMenu variable must refer to a menu instance. The Name variable must
contain the name of the menu item. |
| post |
The value of PosOutput was assigned the position of the submenu, if there
was an error appending the submenu then -1 was assigned to PosOutput. |
insertBefore(SubMenu, Name, Pos, Output)
| func |
Insert a submenu into a menu at a specified position. The position of the
first menu item is 0. |
| pre |
The SubMenu variable must refer to a menu instance. The Name variable must
contain the name of the menu item. The Pos variable must contain an integer. |
| post |
The value of Output was assigned true if the submenu was successfully
inserted, else it was assigned false. |
delete(Pos, Output)
| func |
Delete a complete submenu from a menu. |
| pre |
The Pos variable must contain an integer. |
| post |
The value of Output was assigned true if the submenu was
successfully deleted, else it was assigned false. |
 |
The method deleteItem cannot be
used to delete a submenu. |
remove(Pos, Output)
| func |
Remove a complete submenu from a menu. The class instance is
not deleted when the submenu is removed. |
| pre |
The Pos variable must contain an integer. |
| post |
The value of Output was assigned true if the submenu was
successfully removed, else it was assigned false. |
 |
The method deleteItem cannot be
used to remove a submenu. |
isPresent(SubMenu, Output)
| func |
Determine if a specific submenu is present in the menu. |
| pre |
The SubMenu variable must refer to a menu instance. |
| post |
The value of Output is assigned true if the submenu was
present, else it was assigned false. |
isSubMenu(Pos, Output)
| func |
Determine if a specific menu item contains a submenu. |
| pre |
The Pos variable must refer to a menu item, the position of
the first menu item is 0. |
| post |
The value of Output is assigned true if the menu item was a
submenu, else it was assigned false. |
giveSubMenu(Pos, SubMenu)
| func |
Get the submenu instance of a menu item. |
| pre |
The Pos variable must refer to a menu item, the position of
the first menu item is 0. |
| post |
The value of Output was assigned the submenu of the menu
item, else the variable was not assigned a value. |
giveSubMenuPos(SubMenu, Output)
| func |
Get the position of a submenu. |
| pre |
The SubMenu variable must refer to a menu instance. |
| post |
The value of Output was assigned the position of the submenu,
if the submenu was not found then it was assigned the value -1. |