AXESS PUSHes to Netlinx Button_Event
bob
Posts: 296
HI there,
I have here some old Access code where the control for all AV gear happens in mainline using almost the same Channels but nested in IF (DECK = dvSomeDev) ... ELSE IF (DECK = dvSomeOtherDev) .. ELSE. Prior to puting everything in a Button_Event with all respective Buttons in a Channel Array and using the DECK-Variable inside the Button_Event, I wanted to ask if there is a more elegant way of doing this? In a Button_Event I can't use the IF (DECK = dvSomeDev) outside the PUSH block but have to use it inside each and every push in order to determine how to control the particular device. These devices are quite different, some are controlled using serial, other via IR, others via IR but have some special non-standard timings/commands, etc, so that I can't use a simple SEND to SP statement for all of them. Or could leave it in mailine but it looks quite ugly, however it works this way. Any ideas?
Thanks much!
I have here some old Access code where the control for all AV gear happens in mainline using almost the same Channels but nested in IF (DECK = dvSomeDev) ... ELSE IF (DECK = dvSomeOtherDev) .. ELSE. Prior to puting everything in a Button_Event with all respective Buttons in a Channel Array and using the DECK-Variable inside the Button_Event, I wanted to ask if there is a more elegant way of doing this? In a Button_Event I can't use the IF (DECK = dvSomeDev) outside the PUSH block but have to use it inside each and every push in order to determine how to control the particular device. These devices are quite different, some are controlled using serial, other via IR, others via IR but have some special non-standard timings/commands, etc, so that I can't use a simple SEND to SP statement for all of them. Or could leave it in mailine but it looks quite ugly, however it works this way. Any ideas?
Thanks much!
0
Comments
Can you post the code? That migt help some.
Sound like you want to reuse buttons for multiple devices to control basic transport and most of these devices have the same functionality.
You could put all of the buttons in a button array. Use one button event and use DECK as a pointer to a DevArray of the devices that you want to control. In this way you could use a statement like PULSE[dvaDeck[DeckPointer],1] or any function you want to do. Even like SEND_COMMAND dvaDeck[DeckPointer],"'PON',13"
The pointer would be modified in some source selection routine.
Something like this. The above code is just a frame work to go from. I'm sure there's Syntax problems.
I too am confused as to what elegant means. Elegant - in my opinion - is getting it done and working, with room for adjustments if needed. Are you looking to just make the code more compact?
Thanks again!