Combine Button Events?
jabramson
Junior Member
I have a number of Button Events that run the same code.
Currently I have them listed as:
Is there a way to combine all those button events or do a range?
Thanks
Currently I have them listed as:
BUTTON_EVENT[dvTP1,801]
BUTTON_EVENT[dvTP1,802]
BUTTON_EVENT[dvTP1,803]
BUTTON_EVENT[dvTP1,804]
BUTTON_EVENT[dvTP1,805]
BUTTON_EVENT[dvTP1,806]
BUTTON_EVENT[dvTP1,807]
BUTTON_EVENT[dvTP1,808]
BUTTON_EVENT[dvTP1,809]
BUTTON_EVENT[dvTP1,810]
{
//Do Script
}
Is there a way to combine all those button events or do a range?
Thanks
Comments
-
The way I always do this is define an array of integers and include it instead of a channel number in the BUTTON_EVENT, e.g.
DEFINE_CONSTANT VOLATILE INTEGER btnABUTTONRANGE[] = {801, 802, 803, 804}; DEFINE_EVENT BUTTON_EVENT[dvTP,btnABUTTONRANGE]{ PUSH:{ doScript(GET_LAST(btnABUTTONRANGE)); } }This will call the function doScript with the parameter 2 in the case of button 802 being pushed. -
Perfect, thanks
-
You can also use a devchan array. This will allow you to utilize a single handler for events from multiple devices as well as channels.
... define_variable devchan combinedControl = { {dev1, 1}, {dev1, 2}, {dev2, 1} } define_event button_event[combinedControl] { push: { // do stuff here } } ...
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums