Posts: 474
Threads: 61
Joined: May 2012
Just a thought, haven't looked myself. Is there a min/max function such that you could do something like set(min(limit, new value)) and similar for decreases? I know the syntax is whack, but the concept is there.
Flamin' Noobie...
Warp speed now and don't give me any of that dilythium crystal crap!
Posts: 40,483
Threads: 491
Joined: Aug 2002
There isn't anything like that currently, but it's fairly simple to do. Just something like:
Code:
If (System::LessThan(%(LVar:NewValue), minval))
LocalVars::SetValue(LVar:NewValue, minval);
EndIf;
That will just clip it to the lowest value. And similarly the other way for clipping to the max.
There is a IsInNumericRange, which will check if a value is within a given range, but that's not exactly what you need.
Dean Roddey
Explorans limites defectum
Posts: 474
Threads: 61
Joined: May 2012
I guess the innumericrange could be used as a single test for both up and down.
Flamin' Noobie...
Warp speed now and don't give me any of that dilythium crystal crap!
Posts: 475
Threads: 68
Joined: May 2015
Earlier today I discovered LinkToField, and it is going to save me a LOT of time creating a thermostat popup (and many other location-aware things). The only issue is that with the loss of inc/dec functionality, I have to use a Command Button widget to change temperatures, and that widget (understandably) doesn't support LinkToField.
Does anyone know of a way to implement inc/dec and LinkToField at the same time?
Posts: 40,483
Threads: 491
Joined: Aug 2002
Just save the moniker of the current thermo in a global variable. The actions can reference that moniker to create the target fields names, so something like:
Devices::WriteField(%(GVar:CurThermo).Mode, xxxx, True);
That sort of thing.
Dean Roddey
Explorans limites defectum
Posts: 475
Threads: 68
Joined: May 2015
Oh wow - that's great! I already have the value in a GVar - that's how I'm passing context for the LinkToField settings.
The more I use actions, the more I appreciate what a nice job you did on dynamically building values. :-) At first I thought it was odd that you were saving actual text values for field and variable references, rather than some kind of internal ID. But now I understand. ;-)