Process a menu

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall M_PROCESS([input_string], [help_id][, wait_time]) 



(optional) The “path” to follow to get to a specific menu column entry. (a)


(optional) The help identifier. (a)


(optional) The time-out limit for I/O processing to be completed before returning to the calling routine. (n)


Never time out.

D_GLOBAL or -2

Use the global value (see g_wait_time). (default)


Time out immediately.


Wait up to n seconds (where n is a positive value) for I/O processing to be complete.


M_PROCESS explicitly processes a menu. You rarely need to call M_PROCESS, because menu processing is normally done implicitly during input. However, you may need to use this subroutine at initial program entry to explicitly process the menu when you’re not doing any input.

If you call M_PROCESS while no columns are loaded, UI Toolkit issues a “No columns placed” error (using U_MESSAGE, error-style) and return to the calling routine with g_select false.

Calling M_PROCESS with no arguments is the same as typing the process-menu key when doing input. You will return from M_PROCESS when an entry is selected or when the user presses the process-menu key to deactivate the menu bar.

The input_string simulates what you would type in order to move to a specific position on the menu (for example, what would happen after you pressed the process-menu key). The following characters are valid (not case sensitive):




Name of the entry—the brackets are required


left arrow key


right arrow key


up arrow key


down arrow key


“Enter” key—this is needed to activate a submenu


Any valid quick-select character

Assuming that input_string does not begin with an entry name, the sequence of characters begins as if no menu column is dropped down (in other words, as if M_DEFCOL had been called with a 0 argument). Thus, an initial <R> drops down the first column.

On Windows, the number of arrow movements required does not match the actual keystrokes pressed after the alt key. (Specifically, one more <R> and one less <D> are required.) For compatibility with other platforms, input_string must match the keystrokes for a UNIX or OpenVMS environment.

On Windows, input_string can only specify a submenu entry if it follows a valid menu entry. For example, the following is allowed:

xcall m_process("[menu_entry]<E>[submenu_entry]")

The following is not allowed:

xcall m_process("<R><D><D><E>[submenu_entry]")

Input_string overrides the effect of any previous call to M_DEFCOL, though the default column or entry remains in effect for future calls to M_PROCESS without input_string.

The following example is equivalent to pressing the right arrow key twice and typing the “m” key. In other words, it selects the entry in the second column whose quick-select character is m. (The user must press Enter to complete the selection if the quick-select character is non-unique within the column.)


On Windows, M_PROCESS recognizes the following menu entries (though they generally don’t have a purpose): E_CLEAR, E_COPY, E_CUT, E_MARK, E_PASTE. If a menu entry other than one of these is selected from the menu, g_select is returned with a value of true. G_entnam will contain the uppercased name of the entry the user was on when the user pressed Enter. If the selected menu entry begins with “U_” the EUTILS_METHOD subroutine is called and the menu is reprocessed. If the selected menu entry is “O_HELP” the EHELP_METHOD subroutine is called, with help_id as its argument.

You will need to clear g_select after you satisfy the event.

Additionally, when a menu entry is selected, g_mnustrng will contain the input_string which, in turn, could be passed to the next call to M_PROCESS to get back to the same menu entry.

If the operation times out, g_select is set to true and g_entnam set to the entry name specified in g_time_entry, which is defined in tkctl.def. See g_time_entry. Note that the time-out is reset after each keystroke. Additionally, in Windows environments, if a menu column is dropped down no time-out will occur.

See also


The following example enables menu processing (exactly as if you had pressed the process-menu key at an input).

xcall m_process

The next example processes a menu and selects an entry that is in the third column, one entry down from the top. It passes the argument “menuhelp” to the EHELP_METHOD subroutine if the selected menu entry is “O_HELP.”

xcall m_process("<r><r><r><d>", "menuhelp")

The following example initializes to the entry below the entry whose name is ap, no matter which column contains ap.

xcall m_process("[ap]<d>") 

The following example selects the entry “o_lock” on the submenu accessed by the entry “o_admin.”

xcall m_process("[o_admin]<e>[o_lock]") 

The following code fragment illustrates one way to use M_PROCESS.

     xcall m_process 
       case g_entnam of 
  "ENTRY1"  : xcall entry1 
  "ENTRY2"  : xcall entry2 
  "ENTRY3"  : xcall entry3 
  "EXIT"    : done=TRUE