Tharindu Herath
Tharindu Herath

Reputation: 23

Move to next input field by pressing Enter key in RPGLE display file

I am new to rpgle programming. I want to move the cursor from one integer input field to the next integer input field by pressing Enter key (without pressing the tab key) without clearing previously entered data in the rpgle display file. Plz, help. Thanks in advance.

Upvotes: 2

Views: 1183

Answers (1)

Charles
Charles

Reputation: 23783

You really can't do that.

The 5250 protocol is a block/screen oriented protocol. Meaning that once a screen is sent to a device, the server is out of the picture till the device returns control. Enter is a special key, it's only job is to return control to the server.

Way back when 5250 emulators first came out, the PC Enter by default mapped to the Field-Exit key and the lower right Ctrl key mapped to Enter as that's where those corresponding keys on a physical 5250 keyboard were. Now-a-days, IBM's ACS emulator uses Enter for Enter and Ctrl+Enter for Field-exit.

Field-exit is the behavior you are looking for.

You could as @nfgl alludes to in the comments, simulate the behavior you desire for the user. You can use RTNCSRLOC so that your program knows where the user's cursor was when enter was pressed, and then your program use DSPATR(PC) or CSRLOC to place the cursor on the next field before sending the screen back to the device. Your program would also need to the data previously entered is retained. So for example, instead of input-only fields, your fields would need to be input-output. And you'd need to be sure to not clear the display record before sending it back out.

Upvotes: 4

Related Questions