OFFing an Array of Buttons
TurnipTruck
Junior Member
I would like to do something like this as a means of mutual exclusivity for the sake of feedback:
However this does not work. Does anyone have a suggested alternative for a one-line button-feedback-array killer? I don't want to define as mutually exclusive.
Thanks!
INTEGER cnFEEDBACKS[10]={1,2,3,4,5,6,7,8,9,10}
OFF [dvTP,cnFEEDBCAKS]
However this does not work. Does anyone have a suggested alternative for a one-line button-feedback-array killer? I don't want to define as mutually exclusive.
Thanks!
Comments
-
Is your 'dvTP' an array? It should work if it's a DEV but won't work for an array.
-
I can't see an easy way to do it with out a loop.
The following function seems to work::define_function funBtnArrayKill(dev dvDevice,integer nArrayIn[]) { stack_var integer i for(i = 1; i < length_array(nArrayIn) +1; i++) { off[dvDevice,nArrayIn[i]] } } -
This is basically the same code I posted yesterday on a different thread but this version uses a function in the button event to give the appearance of one line of code but of course it requires the added block of code with in the function. This handles ON as well as OFF in the same manner as Mutually Exclusive probably does.
DEFINE_DEVICE dvTPSwitcher = 10001:1:0 ; dvSwitcher = 5001:1:0 ; DEFINE_FUNCTION fnHandleSwitcherBtnFBack(INTEGER iStartingINdex,INTEGER iBtn) { stack_var integer i ; for (i = iStartingINdex ; i <= iStartingINdex + 7 ; i ++)//handle feedback { if (iBtn == i) { ON [dvTPSwitcher,nSwitcherBtnArry[i]] ; } else { OFF [dvTPSwitcher,nSwitcherBtnArry[i]] ; } } } DEFINE_VARIABLE volatile integer nSwitcherBtnArry[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17} ; BUTTON_EVENT [dvTPSwitcher,nSwitcherBtnArry] { PUSH: { stack_var integer nSwitcherIN ; stack_var integer nSwitcherOUT ; stack_var integer nBtn ; nBtn = get_last(nSwitcherBtnArry) ; Select { ACTIVE (nBtn >= 1 && nBtn <= 8)://select switcher input { nSwitcherIN = nBtn ; fnHandleSwitcherBtnFBack(1,nBtn) } ACTIVE (nBtn >= 9 && nBtn <= 16)://select switcher output { nSwitcherOUT = nBtn ; fnHandleSwitcherBtnFBack(9,nBtn) } ACTIVE (nBtn == 17)://take in & out { TO [dvTPSwitcher,nSwitcherBtnArry[17]] ; send_string dvSwitcher,"ITOA(nSwitcherIN),'*',ITOA(nSwitcherOUT),'!',13,10" ; } } } } -
I haven't had a chance to test it, but shouldn't a DevChan array do the trick?
DEVCHAN dcFeedback[] = {{device,1}, {device,2}, {device,3}, {device,4}} OFF[dcFeedback]
--D -
dchristo wrote:I haven't had a chance to test it, but shouldn't a DevChan array do the trick?
--D
That will work, but I don't like DEVCHANs. I just array the button channel numbers and reference the array. Makes for less code.
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
