Convert subfile/grid field into Button

Use this board to ask questions or have discussions with other Rich Displays users.
norrow
New User
Posts: 9
Joined: Fri Jan 08, 2016 12:19 pm
First Name: Norman
Last Name: Rowden
Company Name: Soft-Pak
City: San Diego
State / Province: California
Country: United States
Contact:

Convert subfile/grid field into Button

Post by norrow »

New to ProfoundUI and DDS conversion...
I have converted my DDS to Rich Display. There is a field in each row of the subfile that is 1 byte alpha. This field will either contain blanks or a "+" sign. the plus sign indicates that additional data is available. I would like to make this a button. When the field is blank, I don't want to show the button. When the field contains a "+" sign I want the button to be visible. In the green screen, the user would place the cursor on this field and press F4 to initiate a call to a program. This would only work if the field contains a "+". Otherwise an error message is issued. I'm not sure how to go about conditioning the button based on the value of the field or to write java script that changes the button visibility by evaluating the field on each row. How would go about doing this?
User avatar
Glenn
Profound Logic Staff Member
Posts: 124
Joined: Mon Apr 14, 2014 4:08 pm
First Name: Glenn
Last Name: Hopwood
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by Glenn »

Norman,

Since you are doing a conversion I assume you are open to modifying your RPG code. Is that correct?

Glenn
norrow
New User
Posts: 9
Joined: Fri Jan 08, 2016 12:19 pm
First Name: Norman
Last Name: Rowden
Company Name: Soft-Pak
City: San Diego
State / Province: California
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by norrow »

Yes. I can modify the code.
User avatar
Glenn
Profound Logic Staff Member
Posts: 124
Joined: Mon Apr 14, 2014 4:08 pm
First Name: Glenn
Last Name: Hopwood
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by Glenn »

Norman,

Sorry for the delay.

Since you're willing to change the code, below is what I would do...
  • Hide/remove the field containing the '+' from the grid.
  • Add whichever button you'd like to use to the same column.
  • Bind the 'visibility' property to an indicator named something like SHOWBTN.
  • Bind the 'response' property to something like MOREINFO.
  • In your RPG, as you're writing the subfile row, decide whether the button should be hidden or visible and set on the SHOWBTN indicator if it should be shown.
  • In your RPG code, after the EXFMT perform a READC loop on the subfile and you should get the row that was clicked by the user.
Does that make sense?

Glenn
norrow
New User
Posts: 9
Joined: Fri Jan 08, 2016 12:19 pm
First Name: Norman
Last Name: Rowden
Company Name: Soft-Pak
City: San Diego
State / Province: California
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by norrow »

Yes it does and I was moving in that direction prior to your response. The original code to process the button wasn't working because it was based on ROW and COL of the cursor at the point the FKEY was pressed. in ProfoundUI, the ROW and COL were based on the first input field in the subfile control so the existing code would never work eventhough I was showing/hiding the button correctly.

So I'm finding that if I click on a subfile record(highlighting it) that doesn't have the button and then click the button in another subfile record the READC in the RPG program is processing both records leading me to believe that simply clicking on a subfile record sets MDT and causes READC to to see that. That being said, wouldn't there me a way to bind the ROW of the record to an RPG variable and thus when the button is actually clicked, all I would need to do is CHAIN with the ROW to the subfile and that's the record to process? If so, how would I bind the ROW value to an RPG variable?
User avatar
Glenn
Profound Logic Staff Member
Posts: 124
Joined: Mon Apr 14, 2014 4:08 pm
First Name: Glenn
Last Name: Hopwood
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by Glenn »

Norman,

I wouldn't normally expect the user clicking on a row to trigger a READC. Do you have an 'onrowclick' event assigned to the grid?

Regardless of why it's triggering a READC with row selection, you can do 2 different things to get the 'proper' row.
1 - You could leave it as is and, during the READC loop, check the MOREINFO indicator that you bound to the 'response' property of your button. This indicator will be 'on' in the row that was clicked.
2 - Place a hidden textbox widget somewhere on the screen (not in the grid), bind it's 'value' property to an RPG variable and put the following code in the 'onclick' property of the button. The RPG variable that you bound to the hidden textbox will then contain the row of the button that was clicked.

Code: Select all

changeElementValue("<id of hidden textbox>",row);
pui.click();
Glenn
norrow
New User
Posts: 9
Joined: Fri Jan 08, 2016 12:19 pm
First Name: Norman
Last Name: Rowden
Company Name: Soft-Pak
City: San Diego
State / Province: California
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by norrow »

Thanks Glen,

I have #1 currently working but will implement #2 as I think it's a much more precise way to code the clicking of the button.
norrow
New User
Posts: 9
Joined: Fri Jan 08, 2016 12:19 pm
First Name: Norman
Last Name: Rowden
Company Name: Soft-Pak
City: San Diego
State / Province: California
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by norrow »

Glen,
Having trouble with #2 implementation. I placed an output widget called H1RRN in the SFLCTL portion of the screen and actually made it visible so I can see the value(will hide it later once this is working). I changed the button in the SFL rcd to display when appropriate and have coded the onClick event as you indicated with....

Code: Select all

changeElementValue("H1RRN", row);
pui.click(btnCF04);

the process in the RPG has always been triggered on F4 so I continued to use that.

The problem is H1RRN is not populated when the RPG gets control following the EXFMT. F4 is on and my routine to process the button is called but H1RRN is zero. On the screen H1RRN shows the correct RRN so the changeElementValue() appears to be working. The question to me, is at what point is that being populated? It seems like maybe it's after EXFMT has been given control. Any ideas?

http://www.profoundlogic.com/forum/down ... iew&id=909

Norm
Attachments
H1RRN.png
H1RRN.png (7.67 KiB) Viewed 3238 times
Last edited by norrow on Fri Feb 19, 2016 1:29 pm, edited 1 time in total.
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: Convert subfile/grid field into Button

Post by Scott Klement »

Norman,

The 'row' variable is only populated when you click on something inside the grid, such as the 'onrowclick' event. It will set the 'row' variable to whatever the user clicked and run your event code.

Does that help?
norrow
New User
Posts: 9
Joined: Fri Jan 08, 2016 12:19 pm
First Name: Norman
Last Name: Rowden
Company Name: Soft-Pak
City: San Diego
State / Province: California
Country: United States
Contact:

Re: Convert subfile/grid field into Button

Post by norrow »

Scott, I think I understand but need clarification.
Glen indicated that would use the onClick event of the button in the grid. Are you saying I need to place my JS code in the onRowClick of the grid?
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests