Help changeing button attribute

Use this board to ask questions or have discussions with other Rich Displays users.
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: Help changeing button attribute

Post by Scott Klement »

Worked fine for me. I tried it with both pui.set() and grid.setDataValue(), both worked perfectly.

Here's my current code:

Code: Select all

var newColor = "gainsboro";
var checkVal = "0";

if ( this.style.backgroundColor == "gainsboro" ) {
  newColor = "green";
  checkVal = "1";
}

// pui.set("CID." + row, checkVal);
getObj("GridC").grid.setDataValue(row, "CID", checkVal);
applyProperty(this, "background color", newColor) ;
applyProperty(this, "field type", "button"); 
Maybe you haven't set the properties on your checkbox properly? (That wouldn't explain why a textbox didn't work, though...) but here are the properties that I'm using:
BedzCheckbox.png
BedzCheckbox.png (10.02 KiB) Viewed 1677 times
And here's the binding for the "value" property:
BedzBinding.png
BedzBinding.png (14.53 KiB) Viewed 1677 times
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: Help changeing button attribute

Post by ppbedz »

Scott, Visually, the js works correct. The grid looks like I want it to look. When I click a button in the grid, the corresponding text box (or check box) contains "1" or "0". However, when control returns back to the rpg to read thru the sfl, the text box does NOT contain the value I see on the screen. I have run the program in debug. If the grid button is green (text box = "1") and I click the button, the button turns gainsboro (text box value = "0"). When the rpg chains to that record, debug shows the text box value as "1" when it should have been changed to "0". Patti
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: Help changeing button attribute

Post by ppbedz »

Scott,

I actually added some dummy "readc" logic to my rpg pgm and it did not find any grid row as "changed". I am guessing that even though I can see values, the js isn't changing the actual data the program reads? Is there a way to accomplish this, or do I have to find a different way to do what I am trying to do?

Thank you,
Patti
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: Help changeing button attribute

Post by Scott Klement »

As I said before, it is working fine for me. Yes, I checked the values in my RPG program. Yes, it is returning the correct values, both when I click the button once and it turns the value on, and when I click it twice and turn the value back off.

I don't know why it's not working for you.
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: Help changeing button attribute

Post by Scott Klement »

If it helps, here is the RPG and DDS that I have been testing with.
Attachments
pbedztestd.dspf.txt
(5.2 KiB) Downloaded 468 times
pbedztestr.rpgle.txt
(1.3 KiB) Downloaded 758 times
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: Help changeing button attribute

Post by ppbedz »

Thank you, Scott. Your code works on our machine. I am going to delete my grid and start from scratch. Thanks for your time!
Patti
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: Help changeing button attribute

Post by ppbedz »

Mystery Solved! I took your screen code and moved to my screen and little by little started to modify until it stopped working. The culprit turned out to be the "bypass validation" property. I have a small red X button in the corner of the window that contains the grid. The red X is the way the user exits the window. It was copied from another program. The bypass validation property on the button was set to "true". Once I removed the property, everything worked fine! Scott, Thank you for your time and patience in helping me work through this. - Patti
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests