select

select(menuItem: MenuItem input;
       closed:   Boolean);

The select event of the MenuItem class is generated for a menu item when the user selects or deselects a menu item. The select event occurs when menu item is highlighted. When another menu item is selected or the menu operation is completed (or cancelled), the previously selected menu item has another select event generated, indicating that it was deselected.

The closed parameter is set to true when the menu item is deselected and to false when it is selected.

An exception is raised if a MenuItem method is invoked from a server method.

The following is an example of the event definition.

menuEmpList_select(menuItem: MenuItem;
                   closed:   Boolean);
begin
    if not closed then
        StatusLine.caption := "List of Employees";
    else
        StatusLine.caption := "";
    endif;
end;

In this example, the menuEmpList is the menu item that is clicked. The closed parameter returns false for the initial select call and true for the deselect call.

This event is designed for the developer to be able to display help text about the menu item while the user considers whether to click the item. The deselect event call enables that help text to be cleared.

The select event also occurs for disabled menu items when they are selected; for example, by holding the left mouse button down and dragging over those items.