Skip to content

On_item Command

See Also: Item_list Command, Send Command

Purpose

To define an item for objects descended from the Menu Class.

Syntax

on_item
[value] [
    send
    message [
        to
        object]
    | begin_pull_down;
    pull_down_name [pull_down_image]
]

What It Does

On_item commands define the items of objects whose base class is menu. This includes objects of Class list, form, entry, and subclasses of those classes. Every on_item command must be contained within an item definition block begun with an item_list command.

Each item created with on_item can be given an initial_value, a string, which is displayed in the visible portion of the item (window). Value may be longer than the window, but it will be truncated on display to the length of the window. If value is omitted, blanks are displayed. The value passed to the item may be a constant, variable, or function. The value of the item will be set to the evaluated argument.

Each item may send a message when the user interacts with the item. The message to be sent is specified using the send keyword followed by the name of the message. By default, message is set to none and it is sent to the current_object.

You may specify a different receiver of the message with the to keyword. If the to keyword is used, the object_id of object is placed in the aux_value property of the item.

Within object definition blocks started with the create_menu command, begin_pull_down may be used to define a child object of Class pull_down_menu whose name is specified in pull_down_name. Begin_pull_down begins a nested item definition block within which the items of the menu may be specified with additional on_item commands. These nested item definition blocks must be terminated with an end_pull_down command. Where desired, nested on_item commands may themselves use begin_pull_down to create deeper levels of nesting.