Skip to main content
Version: 20 R7 BETA

Get menu bar reference

Get menu bar reference {( process )} -> Function result

ParameterTypeDescription
processIntegerReference number of process
Function resultMenuRefMenu bar ID

This command is not thread-safe, it cannot be used in preemptive code.

Description

The Get menu bar reference command returns the ID of the current menu bar or the menu bar of a specific process.

If the menu bar was created by the Create menu command, this ID corresponds to the reference ID of the menu created. Otherwise, the command returns a specific internal ID(*). In all cases, this MenuRef ID may be used to reference the menu bar by all the other commands of the theme.

(*)This specific ID is temporary and becomes invalid as soon as another menu bar is called with SET MENU BAR. If you want to keep the reference of a menu created in the menu editor, you need to copy it in memory using Create menu. For example:

 $vEditorRef:=Get menu bar reference(Frontmost process) //menu from the menu bar editor
 $vMenuRef:=Create menu($vEditorRef) //copy the menu in memory
 SET MENU BAR(2) //install another menu bar
 ... // execute code
 SET MENU BAR($vMenuRef) //back to the initial menu bar

The process parameter can be used to designate the process where you want to get the current menu bar ID. If you omit this parameter, the command returns the menu bar ID of the current process.

Example

Refer to the example of the GET MENU ITEMS command.

See also

SET MENU BAR