Onclick response

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
machine0318
New User
Posts: 4
Joined: Tue Feb 27, 2018 11:46 am
First Name: Renee
Last Name: Taylor
Company Name: Winsupply
State / Province: Ohio
Country: United States
Contact:

Onclick response

Post by machine0318 »

I have an output field that when clicked, I want the application to think I pressed the F8 button. I have defined the onclick of the output field to pui.click("btnCF08"); and btnCF08 has a response defined of iQtys of type indicator. Ultimately, I need the click to call another RPG program that has a parameter defined. How do I get my program to recognize that iQtys should be on or directly call the RPG program onclick?
User avatar
Kaylee Law
Profound Logic Staff Member
Posts: 13
Joined: Mon Sep 18, 2017 11:36 am
First Name: Kaylee
Last Name: Law
Company Name: Profound Logic
Contact:

Re: Onclick response

Post by Kaylee Law »

Thank you for writing in!

If your end goal is to call another RPG program, you can use the pui.run() API in the onclick event of your output field to call RPG programs. For example:

Code: Select all

pui.run({program:"LIBRARY/PROGRAM"});
You can find more information on the pui.run() api here: http://www.profoundlogic.com/docs/pages ... Id=7864464

~Kyle
Kaylee Law
Technical Support Specialist
Profound Logic Software
machine0318
New User
Posts: 4
Joined: Tue Feb 27, 2018 11:46 am
First Name: Renee
Last Name: Taylor
Company Name: Winsupply
State / Province: Ohio
Country: United States
Contact:

Re: Onclick response

Post by machine0318 »

How do I specify a parameter with pui.run? I can't find an example and I'm not familiar with js.
User avatar
Kaylee Law
Profound Logic Staff Member
Posts: 13
Joined: Mon Sep 18, 2017 11:36 am
First Name: Kaylee
Last Name: Law
Company Name: Profound Logic
Contact:

Re: Onclick response

Post by Kaylee Law »

machine0318 wrote:How do I specify a parameter with pui.run? I can't find an example and I'm not familiar with js.
To pass parameters with pui.run() you need to add a configuration option to add a javascript object that contains the parameters. For example:

Code: Select all

pui.run({
  program:"LIBRARY/PROGRAM",
  params:{
    p1:"parm1",
    l1: 50,
    p2:"parm2",
    l2: 50,
    p3:"parm3",
    l3: 50
    }
});
defines an object that contains 3 parameters of length 50.

But after re-reading your original post, I am not sure this will be the solution you are looking for. When using pui.run() in Rich Display Applications, instead of control returning to the calling program after the called program ends, the session will end.

You mention that you have a button with id of "btnCF08" with a response bound to the feild iQtys which is defined as an indicator. In your RPG you can just use iQtys, like you would any other indicator, for example:
RPG CODE
if iQtys = *on;
//call program
endif;
Alternatively, we also have an API that simulates a button press.

Code: Select all

pressKey("F8");
You can find more information on the pressKey() API here: http://www.profoundlogic.com/docs/pages ... Id=4849987

~Kyle
Kaylee Law
Technical Support Specialist
Profound Logic Software
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: Onclick response

Post by Scott Klement »

pui.run() is used to start a new Rich Display session that runs an anonymous program.

If you are simply trying to call another RPG program in the same session, you can do so the same way you did it in green-screen applications. Just use the standard RPG prototype with the EXTPGM keyword, or the old-fashioned CALL/PARM opcodes. There's no special logic needed for a Rich Display, just use a standard call like you've always done.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest