Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter SeventeenApplication Integration Functions (continued)

MenuTrackAdHocPopup Function

Overview

The MenuTrackAdHocPopup function presents an ad hoc popup menu to the user and allows a selection of one of the menu items in the selection array.

Syntax/Parameters

Syntax

int = MenuTrackAdHocPopup ( string list[], int x, int y );

Parameters

list[]

A string array containing menu strings and codes to present on the menu. The first empty item or the end of the array determines the last item added. The ‘&’ character can be used as a key code for keyboard selection of the menu item. Prefixing the menu item with ‘-’ will disable the item.

x y

A pair of int values that specify the X and Y screen positions, in pixels, to place the upper left corner of the menu. Note that as the menu is presented by Windows, its position maybe adjusted to fit the menu on the screen.

Return Value

Returns an int containing the index of the selected item or -1 on failure. Use the GetLastError function to retrieve a formatted error code. The most common error is ERROR_CANCEL if the user clicks off the menu or presses the ESC key. Programmers are cautioned to check the result as an error prior to indexing the provided list.

Remarks

MenuTrackAdHocPopup differs from MenuTrackPopup in that the menu items do not have to be predefined as application level menu functions.

A frame window is required for this function to operate. Within an application desktop, the frame is setup automatically. When operating within a Legato Basic environment, a frame window will not exist unless a dialog is open. If a frame window is not defined, the function will return a context error.

The position is in screen coordinates where 0,0 is the upper left of the farthest left monitor.

The list parameter can contain display strings or three control terms:

‘separator’

Adding this string results in a separator line being added to the menu.

‘popup string’

Adding this string creates a popup group and adds a named position to the current menu node. The ‘string’ becomes the text of the popup. All following items are added to the popup sub menu until the ‘endpopup’ is found. An endpopup is not required if the list of menu function codes simply ends. The string is required.

‘endpopup’

Using this string ends a popup section and moves up the tree to the parent menu.

Many of the returned error codes will contain the offending list index in the low word of the return value. 

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic