Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to have a button go through three options? Such as changing floors?
#1
This is probably something simple that I am missing. I am trying to toggle between 3 floors (for example).
I currently have it working with two floors, but how would I do it that it if its on the 2nd floor go to the third, and then back to the forth. I dont believe you have have 2 levels of else?

ALso, what would be the best way  to cycle between overlays based on the click? I was trying it with states, but then it gets very messy in the UI editor.

Thank you


Code:
If
System::Equals
    P1=$(TimerVars.FloorNumber)
    P2=1
    P3=Case

Devices::FieldWrite
    P1=TimerVars.FloorNumber
    P2=2
    P3=True

Else

Devices::FieldWrite
    P1=TimerVars.FloorNumber
    P2=1
    P3=True

End
Reply
#2
Use nested if/else statements for the first two floor checks and a regular if for the third floor check



Code:
If floor == 1
 // on floor 1, do something
Else
 // check floor 2
 If floor == 2
   // on floor 2, do something
 Else
  // check floor 3
  If floor == 3
    // on floor 3, do something
  End If
 End If
End If
Reply
#3
Thank you. Do you know what the command would be to unload an overlay?

Thanks
Reply
#4
Hide or load a new one based on the floor?
Reply
#5
It's even easier if you just use CreateVariable to create a global variable which is an enumerated string. You can then use the AdjustEnumVal command of the variables target to cycle through the values.

The only way to 'unload' an overlay would be to load an empty template into it.
Dean Roddey
Explorans limites defectum
Reply
#6
The only issue I can think of with that, is that if lets say I have three floors I want to cycle between. When in the design programmer, it will get very crowded as they will all be on top of each other.
Any suggestions based off of that?

Thank you
Reply
#7
Just load a new template into the overlay for each floor as you cycle. So hit the button, do the cycle, and use the new value to load the appropriate floor template into the overlay.

Make the value of the enum match the template name to load, and you can just ad the new value of the enum to the relative path and use it directly to load the template (i.e. no if statements or anything.)
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Changing WebRIVA Splash Image? gReatAutomation 4 446 01-07-2020, 05:28 PM
Last Post: gReatAutomation
  Button Click changes button image? gReatAutomation 6 669 08-05-2019, 03:53 PM
Last Post: Dean Roddey
  Missing how to tell CQC to read a Lutron keypad button pressed ghurty 7 1,187 01-08-2019, 09:55 PM
Last Post: Dean Roddey
  Options for CQC controlled video playback pjgregory 2 913 04-23-2018, 10:06 AM
Last Post: Dean Roddey
  Changing Field Values in Devices Tab TurboSam 3 1,506 01-01-2018, 02:47 PM
Last Post: Dean Roddey
  Russound V2 Driver - no install button bpaetzold 1 1,178 12-24-2017, 07:13 PM
Last Post: Dean Roddey
  LoadOverlay helper button error dlmorgan999 9 3,589 09-10-2017, 01:22 PM
Last Post: dlmorgan999
  SOLVED -- Button States agarden 6 3,131 05-28-2017, 10:02 AM
Last Post: agarden
  CML Manifest Options zra 7 2,025 05-07-2016, 09:22 AM
Last Post: zra
  Hide Command Button potts.mike 1 1,478 05-06-2016, 12:24 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)