Keystroke-enabled text edits for graphical controls - cut, paste, and copy

0 Likes

Problem:

The following resolution describes how to assign values to Ctrl C, Ctrl X, and Ctrl V in order to copy, cut and paste text from controls in graphical user interface COBOL programs and send output to the Windows API.

Resolution:

To use the ctrl-key combinations, it is possible to programmatically assign any value to these functions by using format 13 of the SET verb.  So, for example, you wanted to assign the keys for copy, cut and paste to be Ctrl C, Ctrl X and CTRL V the following code would be needed in the program:

SET EXCEPTION VALUE 3 TO COPY-SELECTION.

SET EXCEPTION VALUE 24 TO CUT-SELECTION.

SET EXCEPTION VALUE 22 TO PASTE-SELECTION.

The exception values here are the default values assigned to Ctrl C, Ctrl X and Ctrl V.  

It is also possible to assign different values to these keys through the configuration file because the value returned for Ctrl C (3) is by default the same if a user pressed Function Key 3.

Alternatively, to assign another value for Ctrl C, etc., in the configuration file could be modiefed with the following:

KEYSTROKE Exception=2003 ^C

KEYSTROKE Exception=2004 ^V

KEYSTROKE Exception=2005 ^X

The program would then include the following code:

SET EXCEPTION VALUE 2003 TO COPY-SELECTION.

SET EXCEPTION VALUE 2004 TO PASTE-SELECTION.

SET EXCEPTION VALUE 2005 TO CUT-SELECTION.

Old KB# 2661
Comment List
Anonymous
Related Discussions
Recommended