Charmed Quark Systems, Ltd. - Support Forums and Community
Field Incr/Decr Button Widget - Printable Version

+- Charmed Quark Systems, Ltd. - Support Forums and Community (https://www.charmedquark.com/vb_forums)
+-- Forum: General Discussion (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=3)
+--- Forum: Installation/Configuration (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=10)
+--- Thread: Field Incr/Decr Button Widget (/showthread.php?tid=9138)

Pages: 1 2


Field Incr/Decr Button Widget - khill - 12-21-2014

I thought I remembered some discussion on the Incr/Decr button going away - with new versions... - Did it?

My tstat setpoint buttons no longer work and I didn't find an equivalent function in the editor.

How are others handling this?
Kerry


Field Incr/Decr Button Widget - wuench - 12-21-2014

Yeah they no longer work, I just converted mine to command buttons and increment the field in code...


Field Incr/Decr Button Widget - pinballmark - 12-21-2014

It's a side effect of the gesture support

http://www.charmedquark.com/vb_forum/showthread.php?t=11635


Field Incr/Decr Button Widget - khill - 12-21-2014

wuench Wrote:Yeah they no longer work, I just converted mine to command buttons and increment the field in code...

Any chance you can share an example of your action parameters?


Field Incr/Decr Button Widget - Dean Roddey - 12-21-2014

Though it's a little more work, it's fairly straightforward to create a generic 'number adjuster' popup that you can pass a numeric field to, and have it allow you to adjust the value with a slider and then the user can either accept or cancel. If they accept, then the updated value is written to the field. When it associates the field with the slider, that slider will pick up its field limits and allow the user to adjust accordingly.

Or, if you really want to adjust by inc/dec, you can do that as well. There's actually an example one in the auto-generated content that lets you do both.


Field Incr/Decr Button Widget - wuench - 12-21-2014

Code:
[B]Up/Plus[/B]
[OnClick]
   Devices::FieldRead(Security.T1CoolSP, LVar:Temp, True)
   LocalVars::Add(LVar:Temp, 1)
   Devices::FieldWrite(Security.T1CoolSP, %(LVar:Temp), True)

[B]Down/Minus[/B]
[OnClick]
   Devices::FieldRead(Security.T1CoolSP, LVar:Temp, True)
   LocalVars::Subtract(LVar:Temp, 1)
   Devices::FieldWrite(Security.T1CoolSP, %(LVar:Temp), True)



Field Incr/Decr Button Widget - Dean Roddey - 12-21-2014

To be safe, you should also check that you aren't exceeding the limits, or even more likely that you aren't exceeding some more arbitrary limit that you want to keep it to.


Field Incr/Decr Button Widget - khill - 12-21-2014

wuench Wrote:
Code:
[B]Up/Plus[/B]
[OnClick]
   Devices::FieldRead(Security.T1CoolSP, LVar:Temp, True)
   LocalVars::Add(LVar:Temp, 1)
   Devices::FieldWrite(Security.T1CoolSP, %(LVar:Temp), True)

[B]Down/Minus[/B]
[OnClick]
   Devices::FieldRead(Security.T1CoolSP, LVar:Temp, True)
   LocalVars::Subtract(LVar:Temp, 1)
   Devices::FieldWrite(Security.T1CoolSP, %(LVar:Temp), True)

Thanks wuench - its works perfect, back to normal.

Dean - are you saying to set upper and lower limits for the setpoints such that the increments can't exceed the limit?
If so, would you accomplish that with an If/Then argument in the action?


Field Incr/Decr Button Widget - Dean Roddey - 12-21-2014

Yeh, you'd just compare the current value and only do the inc/dec and write back if it's within the limit, so something like:

Code:
Devices::FieldRead(Security.T1CoolSP, LVar:Temp, True)
If System::LessThan(%(LVar:Temp), 90)
   LocalVars::Add(LVar:Temp, 1)
   Devices::FieldWrite(Security.T1CoolSP, %(LVar:Temp), True)
EndIf;

You could make it fancier and do an If/Else and in the Else do a popup that says it's already at the max or something.


Field Incr/Decr Button Widget - khill - 12-21-2014

Thanks Dean - Sounds like a good idea. I'll work on it....