Mouse Click Strings

Revised and reviewed May 2012

In order to implement the effect of allowing a user to be able to click on a field in order to edit it (as is typical in Windows forms), you need some way of telling your application that the click event has happened. The recommended way to do this is to encode unique high-numbered pseudo-function-key exit codes with each field. The format for this is:

"~" + chr(7) + chr(250) + "###."

or

"~VK_xF###"

In the above examples, note that each starts with a tilde, i.e. "~" or chr(126) which signals the end of any prior clause and the start of the click string definition. The two variations are equivalent, with the second one being the newer (easier to type and to read as text) format. Note that the trailing decimal point is mandatory in the first format, and not used in the second format. The ### characters (which can be as few as 1 digit and as many as 6) indicate the number of the pseudo-function key. For example, the number 231 would indicate the pseudo-function key 231, and would cause the current event-sensitive operation (INFLD, XTEXT, XTREE, AUI_EVENTWAIT, etc.) to return with exitcode -231.

To further clarify with an example, let's say you have a screen with 20 fields, each using the above technique to associate itself with a pseudo-function key 201 thru 220. If the user is currently editing field 1 and then clicks on field 15, the INFLD call to edit field 1 will return with exitcode -215, allowing the program to do any post-field processing on field 1 and then proceed to edit field 15. Obviously this requires more programming effort than a purely sequential input scheme, but is amenable to various systematic approaches, including AUI Eventwait.

If hlpidx contains both a tool tip and a mouse click string, the tool tip must be in the first position, followed by the chr(126) (or tilde), and then the mouse click string, e.g.:

hlpidx = ">Tool tip first" + "~VK_xF231"

Comments

The click string syntax and behavior is common to most other GUI-enabled controls / subroutines, including AUI_CONTROL, XTREE and XTEXT, with the only difference being INFLD's requirement of the leading tilde—which is required because hlpidx is used for multiple things.

INFLD also supports a more primitive (now deprecated) mouse click response mechanism termed Mouse Cursor Reporting. When active, INFLD treats a click outside of the field as an exit condition, returning exitcode -47. You can then retrieve further information about the last click by calling MX_MCRS.