Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Navigation: Subroutines > INFLD > INFLD Parameters > hlpidx

Context Menu Handling

Scroll Prev Top Next More

You may replace the standard context menu for normal INFLD edit controls and also INFLD combo box controls by adding the desired context menu definition string to the tooltip string (which is itself part of the hlpidx parameter). The syntax is:

>tooltip\menudef

The backslash marks the end of the tooltip definition and the beginning of the menudef string. The menudef syntax is the same as that for XTREE PopupMenu definitions, i.e.:

text,command;text,command; ... ;text,command

The command fields may be either virtual keycode strings (e.g. VK_xF101), or arbitrary text (optionally containing control sequences using ^ as the lead-in), or $CUT, $COPY, or $PASTE (for the standard clipboard operations).

The text fields will be displayed in the context menu as-is, with the exception of "--------" which displays a separator line. For example:

>tip\Cancel,VK_ESCAPE;All,*^m;--------,;Cut,$CUT;Copy,$COPY;Paste,$PASTE

The above tooltip string defines a tooltip "tip" and a context menu with the following options:

"Cancel" sends an escape (VK_ESC). "All" enters the character "*" into the field followed by a carriage return (*^m). "Cut", "Copy", and "Paste" act like the standard operations.

Note that the hlpidx parameter may contain a help key, a tooltip, a context menu definition, and/or a click command, but they must be in the following order:

help key >tooltip \menudef ~clickcmd

Furthermore, if you have a menudef but not a tooltip, you must specify the ">" anyway, e.g.:

help key >\menudef ~clickcmd

This latter condition avoids compatibility issues with help keys that might contain "\", although any existing tooltips which contain "\" will be effectively truncated at that point, with a probably non-functional context menu replacing the standard one. While this could be annoying, it seems remote enough and not critical enough to go to additional lengths with cumbersome syntax to avoid.