Visual COBOL Generate KeyStroke.
Is there any way to generate KeyStroke programatically to move cursor control to the next field. The same feature was handled by the TAB key. Client's requirement is to validate each of the fileds in the screen and if validation success it automatically highlight the next fileds. During validation control is back to the program level but how again is it possible to retrieve the screen with very next field activated. Please help.
You haven't given any infiormation on how the user interface fields are implemented so it will be difficult for anybody to give you a definitive answer. Is the code using SCREEN SECTION, Dialog System, Windows Forms or something else ?
If it is SCREEN SECTION you could set the TAB key to terminate the accept, using the key mappings in ADISCF, use the CURSOR IS clause to determine which field you were on, do the required validation and then redo the ACCEPT/DISPLAY with the CURSOR positioned at the rquired field by updating the CURSOR IS value.
The CURSOR IS is defined in the SPECIAL-NAMES paragraph of the CONFIGURATION SECTION of the ENVIRONMENT DIVISION of your program containing the SCREN SECTION. The following is from the product documentation :
CURSOR IS data-name-1
The CURSOR IS clause specifies the data item to contain the cursor address used by the ACCEPT statement.
At the start of an ACCEPT statement, if data-name-1 contains a value that is a valid character position on the screen, that position is used as the initial position for the cursor. Otherwise, data-name-1 is ignored, and the initial position for the cursor is the start of the first input field on the screen. At the end of an ACCEPT statement, if the position in data-name-1 has been used in that statement, data-name-1 is updated to show the position of the cursor at the termination of the ACCEPT statement.
CURSOR IS has no effect on the positioning of fields on the screen.
Data-name-1 must be 4 or 6 characters in length. If data-name-1 is 4 characters in length, the first two characters are interpreted as line number, and the second two as column number. If data-name-1 is 6 characters in length, the first three characters are interpreted as line number, and the second three as column number.
The clause has no effect if data-name-1 contains an illegal position (for example, zeros, a nonnumeric value, or a value that is beyond the bottom of the screen).
If data-name-1 contains a valid position that does not correspond to an input field being accepted by the current ACCEPT statement, the cursor is positioned to the next such field or, if there is none, to the first such field. The ordering of the fields is the order in which their descriptions appear in the Data Division.