12.5 MenuItem Object

Provides properties that let you manipulate menu items, such as:

12.5.1 Enable property

Enables or disables the specified menu item.

Syntax

object.Enable[=Value As Boolean]

Type

Boolean.

Attributes

Read/write.

Remarks

Value is an optional parameter that enables (TRUE) or disables (FALSE) the menu item.

Example

See example in Example.

12.5.2 ItemBackColor property

Sets or returns the background color of the menu item.

Syntax

object.ItemBackColor[=ColorConstant As Constant]

Type

Integer.

Attributes

Read/write.

Remarks

ColorConstant is an optional parameter that sets the background color of the menu item. See Section A.3, Background Color Constants.

Example

See example in Example.

12.5.3 ItemForeColor property

Sets or returns the foreground color of the menu item.

Syntax

object.ItemForeColor[=ColorConstant As Constant]

Type

Integer.

Attributes

Read/write.

Remarks

ColorConstant is an optional parameter that sets the foreground color of the menu item. See Section A.14, Foreground Color Constants.

Example

See example in Example.

12.5.4 Name property

Returns the name of the menu item.

Syntax

object.Name

Type

String.

Attributes

Read/write.

Example

This example creates a text window with a menu using the properties and methods of the Menu object and MenuItem Object.

Win.Define(2,4,20,50)
Win.Title = "Sample Menu"
Win.Backcolor = 48
WIN.Visible=TRUE
WIn.TextWrap=TRUE
"Sets a menu object
Set menu = WIN.Menu
’Defines the position of the menuobject in the text window
menu.Define(2,4)
’sets the background color of the menu window
menu.Setbackcolor(80,112)
’Sets the foreground color of the menu window
menu.Setforecolor(6,2)
’Add a new menu item
menu.AddItem("New")
menu.Additem ("Open")
menu.Additem("Edit")
menu.Additem("Exit")
’Activates the menu window
item = menu.select()
’Returns the selected menu item
Set menuitem = menu.Getitem(item)
’Activates the menu item
menuitem.enable =TRUE
’Sets the background color of the menu item
menuitem.itembackcolor = 16
’Sets the foreground color of the menu item
menuitem.itemforecolor = 5
’displays the name of the menu item.
WIN.Popup("The selected menu item is ", menuitem.Name)