Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: rrc1962 on May 19, 2016, 04:19:15 PM

Title: Getting the value of a text box
Post by: rrc1962 on May 19, 2016, 04:19:15 PM
I have a text box named 'Test1' with a description of 'Test Box 1'.  This is what I'm doing, but I get nothing even though I can see a value in the text box.

val = scr.GetProperty('Test1','Value')
wx.wxMessageBox(val)

It doesn't error, just returns a blank in the message box. What could be going wrong?   Thanks
Title: Re: Getting the value of a text box
Post by: DazTheGas on May 19, 2016, 05:05:42 PM
Ive just recreated what you have and all works fine my end??

DazTheGas
Title: Re: Getting the value of a text box
Post by: rrc1962 on May 19, 2016, 06:44:28 PM
Could it be a scope issue?  I have a value of 50 in the text box, yet nothing shows in message box.  I'm just firing this code with a button on the screen.  Spelling is correct.  I even copied and pasted the text box name into the script to be sure.
Title: Re: Getting the value of a text box
Post by: rrc1962 on May 19, 2016, 11:01:53 PM
Still can't get a value out of a text box, but I can read the value from the register.  This exercise was to read the text box value and write it to a file on close, then read it back from the file and populate the DRO text boxes.  Works just as well reading the values from the registers.
Title: Re: Getting the value of a text box
Post by: rrc1962 on May 24, 2016, 02:31:19 PM
Turns out I was trying to get the value of a text box, which doesn't have a value property.  Switched to a DRO which does have a value property and added them to the Persistent DRO section of the PLC script.  It's all working great now.