Button Events
Howdy all- newbie NetLinx programmer here. I had a question about Button Events that I can't seem to find an answer for in the online training material.
In my code, there are a few buttons that, if enabled, I want to have disabled when a user turns off the system. If I were to shut off the buttons in a function using off[btnName] command in NetLinx studio, would that trigger a Button Event for the button if one exists? Or do button events only occur when the button is physically pressed on a touch panel?
I would test this myself on a touch panel and controller- however the only AMX equipment available at my institution that I could test this on is currently in use in our classrooms and won't be available until the end of the semester.
Any further information on Button Events and whether or not they're triggered using the on[] or off[] commands is much appreciated!
Thanks,
Amina
Comments
Button events are not triggered by using 'on' or 'off'. Those are 'output' keywords.
Imaging a button being split into 2 parts: an input part and an output part. A button event is triggered when the input part is activated, usually with a button press on a touchpanel (or keypad) or maybe with a program statement like 'DO_PUSH'.
The output keywords 'on', 'off', 'to' 'pulse', etc. activate the state of the button, the feedback, only
So on[dvTP,1] would set the button with channel number 1 to it's on state but not trigger a button event.
I do not know what you are trying to do, but buttons aren't 'enabled' or 'disabled' with 'on' or 'off'. If you do 'OFF[dvTP,1]' only the state of the button will change, nothing else in the system will change. To actually disable a button (so nothing will happen when a user touches it) you need a 'send_command': SEND_COMMAND dvTP,"'^ENA-1,0'" will disable button 1 and it's associated button_event will not trigger when it is touched. If your goal is to prevent users from interacting with buttons on the touchscreen when the system is off, it's probably better to set the panel to a different page, with just a button to turn the system back on. But again, I don't know what you are trying to accomplish.
Echoing Richard, it's ambiguous what you are operationally intending to happen. A page flip to hide buttons on conditions may not be what you think you want. If you mean you want functions to end or actions to occur on room off, no need to thread that command through buttons that would do it... just do the thing. If you mean you want some functions you put on buttons to only work if the room is on, then add logic to the process that if button AND status, do. You can also turn the visibility of a button on and off... so many ways to do things, and I am not sure you really are thinking your actual needs through before trying to build buttons...
Hi all- thanks for the information about 'on' or 'off' and that it only activates the state of the button and not button events.
To clarify my original post- I'm not trying to hide or disable buttons. I'm wanting to ensure that they're in a consistent 'on' or 'off' state once the system is shut off by someone and that audio levels, video source selection and otherwise will be reset to default values so that the next person using the system will have a consistent experience and know what to expect when starting the system up.
I've already set up a shutdown function that communicates to all the necessary peripheral devices when the system is shut off. I just wanted to confirm that using 'on' or 'off' in that function to reset the button states wouldn't trigger additional commands that I don't want to have triggered- which it doesn't sound like it will.
Thanks,
Amina
Setting the channel state of a button
on[dvTP,255]
does not trigger a button event from the device at the controller.