Intercept the enter key?

Use this board to ask questions or have discussions with other Genie users.
Post Reply
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Intercept the enter key?

Post by rmarsh »

We have a situation where a field requires a field exit then an enter. Is it possible to intercept the enter key and change the function?

I'm not sure how one would know if the user was in the appropriate field or not. Is there anything like CSRLOC in Genie?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Intercept the enter key?

Post by Scott Klement »

CSRLOC should work the same in Genie as it does in any other 5250 emulator. Not sure how that helps, here, unless you want to handle the change in your RPG program.

Every field has a whole bunch of JavaScript events that you can code for. For example "onkeydown" would be run when the user presses a key. You could have code in the onkeydown for a particular field that does something like this:

Code: Select all

if (event.keyCode == 13) {
   pui.fieldExit();
}
In this case, when the user hits enter (which is character code 13), it runs the "pui.fieldExit()" API. After that is complete, the ENTER will still be processed as normal (because I didn't prevent the default action from occurring... though, you could.)
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Re: Intercept the enter key?

Post by rmarsh »

That's what I needed. Thank you.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest