Facility Control

 View Only
  • 1.  How to read a CheckBox state from a button press.

    Posted 01-17-2018 22:18
    Hi all,

    I'm looking to assign a task to button1 to read the state of checkbox1. (If button1 state == true do....) but the code alludes me. Can someone assist?

    Any good resource for code examples?


  • 2.  RE: How to read a CheckBox state from a button press.

    Posted 01-18-2018 14:21

    Hi dbartlett,

    This should be straightforward using Visual Logic, saves you the trouble of having to figure out the exact syntax. (Note: If you do it in Visual logic, it does write the script for you so in the VL editor you can select the 'ogScript' button which shows it to you.

    The following Visual Logicblock prints to the debug window the current state of a checkbox when a button is pressed.



    This isn't the only way to do it, but, it hopefully makes sense to you.




    #DashBoard


  • 3.  RE: How to read a CheckBox state from a button press.

    Posted 01-31-2018 18:10
    Where do I find Value.Checkbox ? I don't see it in the Controls or API's? The rest is straight forward.
    #DashBoard


  • 4.  RE: How to read a CheckBox state from a button press.

    Posted 01-31-2018 18:17

    You need to create the parameter. See steps in the attached screen shot. Once you select the button with the picture of the checkbox, click your panel and drag the area you'd like the component to fill (the green rectangle in my screen shot).



    Hope that helps!

    James


    #DashBoard


  • 5.  RE: How to read a CheckBox state from a button press.

    Posted 01-31-2018 18:24
    Ah, I see. I have a table/grid filled with buttons, set as check boxes. I can't see the buttons in the parameter list.
    #DashBoard


  • 6.  RE: How to read a CheckBox state from a button press.

    Posted 02-02-2018 11:52
    I completly understand your confusion @dbartlett , I had this one as well. As @jamespeltzer mentions above, you can create a toggle button through the use of "button", however, this is a "dumb" button that only changes it's style/appereance, there is actually no true/false, 1/0, on/off value assosiated with it.

    In order to create a toggle button you need to create parameter button (use the one with checkbox, not the dropdown list with "true" in it - the bottom right one). Create a new parameter with the button and you can now read this value. It will be 0 for it's "off" state, and 1 for it's "on" state.
    #DashBoard