Sending Two Enter key Events

Use this Forum to post your “How to …” questions about your use of aXes. This is not a technical support forum. Both the aXes Support Team at LANSA and other aXes customers may answer your questions. LANSA cannot guarantee the accuracy of any information posted by customers.

Moderator: jeanmichel

Post Reply
User avatar
VLNinja70
Posts: 2
Joined: 09 Aug 2017, 02:38

Sending Two Enter key Events

Post 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
Image
User avatar
jeanmichel
Posts: 109
Joined: 23 May 2014, 11:37
Location: Sydney

Re: Sending Two Enter key Events

Post 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);
Regards,

Jean-Michel Rapin

LANSA Pty Ltd
email: JeanMichel.Rapin@lansa.com.au
Address: 122 Arthur Street, North Sydney, NSW 2060, Australia
Tel: +61 289 070 262 http://www.lansa.com | http://blog.lansa.com |
Post Reply