Page 1 of 1

Sending Two Enter key Events

Posted: 05 Oct 2017, 02:02
by VLNinja70
Hey guys,
Going through the axes extensions tutorials for 410 and I'm at the part where I'm adding buttons to my home screen.
I added the addlible AXESLIB button and the button to run the command but I was wondering if I can put both of those commands on both.

I created a 3rd button that runs addlible first sends the enter key and then should call the program via the command line.
What ends up happening is the addlible part works, but in my command line the call program shows up but is never executed.

Here is my onClick code in the button:
FIELDS("CommandLine").setValue("ADDLIBLE AXESDEMO");
SENDKEY(ENV.defaultKey);

var F = FIELDS("CommandLine");
F.setValue("CALL XHRRPGTRN");
SENDKEY(ENV.defaultKey);

Am I missing something or does it just not work like that?

Thanks! :D

Re: Sending Two Enter key Events

Posted: 05 Oct 2017, 07:46
by jeanmichel
Hi!

The IBMi command field only takes one command. Hence you will have to submit the screen twice. The screen is submitted when th enter key is pressed {SENDKEY(ENV.defaultKey);}. The's why in your case the CALL is never executed, since the code never gets to this part.

If you want to send both commands in one go, you need to create and compile a CL program with both commands and then you can call your CL with CALL myprog

Therefore your button script would be:

var F = FIELDS("CommandLine");
F.setValue("CALL myprog");
SENDKEY(ENV.defaultKey);