Page 1 of 1

How to pass the menu response to the program

Posted: Tue Mar 21, 2017 5:32 pm
by TomM
I am working with context menus. Currently doing the following in the onoptionsclick property in the context menu:

Code: Select all

var rowClicked = this.pui.properties["user defined data"];

switch(value) {
  case 'V':
    var imageObj = getObj("BtnView." + rowClicked);
    break;
  
  case 'C':
    var imageObj = getObj("BtnChange." + rowClicked);
    break;
  
  case 'D':
    var imageObj = getObj("BtnDelete." + rowClicked);
    break;
  
  case 'E':
    var imageObj = getObj("BtnExpand." + rowClicked);
    break;
}
pui.click(imageObj);
So basically clicking the button for the option I want. Then in the RPG, I do:

Code: Select all

When Scn_BtnDelete = *On

etc...

The problem with this approach is that I need a button for each menu option.
I want to just pass the Choice value to the RPG. I would assume this would get passed in the "Menu Response" field, but it is always blank.

Instead of doing the switch statement in JS, I want to do it in RPG.

Basically I want to be able to do this in the RPG:

Code: Select all

When Scn_CtxRsponse = 'V';

When Scn_CtxRsponse = 'D';

When Scn_CtxRsponse = 'E';

etc..etc...
Is this possible?

Thanks

Re: How to pass the menu response to the program

Posted: Wed Mar 22, 2017 11:05 pm
by Scott Klement
Either (a) eliminate the onoptionclick (if it us unneeded) and simply always the Menu Response property....
... or use pui.set() to set a hidden textbox to the value...