Change a TP4 button channel dynamically
George Krietsepis
Posts: 284
Dear All,
is there any way and the possibility for a TP4 button channel to be dynamically reassigned through the code ? For example the port 1 channel 100 to be changed to port1 channel 200.
Thanks,
George
is there any way and the possibility for a TP4 button channel to be dynamically reassigned through the code ? For example the port 1 channel 100 to be changed to port1 channel 200.
Thanks,
George
0
Comments
Nope. You can use REBUILD_EVENT to generate a new event table but you can't change the actual channel code of a button to the fly. What are you trying to accomplish?
May I ask why? Without the two letter word, well i dont know what I would do with my life.
? {{<Ctrl>B -or- <RtClick>Show External Controls}}
? Select all the buttons you want to customize (on a per-page scheme)
? Select the [General] Properties Tab
? Change [Override Global Settings] to [yes]
? Now each hard button can be selected per normal TP button & on the [Programming] Properties Tab you can change the [P:C] values
I think this is definitely the more labor intensive way (not only with development, but especially with regards to maintenance/support...) and I agree with [USER="1623"]ericmedley[/USER] and I track a flag & use a conditional expression.
I cannot explain in details, but if statements needed I should use hundreds of "if"...."if"...."if"...."if"...."if"...."if"...."if".... ones.
I'm sorry but this still doesn't change the argument. And the fact that, in any case, you cannot do it, still points you in the same directino: doing it in code. The whole If If If If thing too is not necessary.
Here's a smiple approach. make a variable that tracks the mode of the button. How many modes? Who cares - lets say the one button can do 100 different things. In code as you go along you're tracking what mode the system is in. Cable/Satellite/HVAC/Pop Up Toaster/Coffe Maker/World Wide ThermoNuclear War Engage/etc...
You can even create constants that chagne the numbers into text.
integer Mode_Cable=1;
integer Mode_Satellite-2;
integer Mode_ThermoNuclear_war=55;
etc..
Then in code you just track it
so what you end up with is a button event (or a button event that goes off to a function )
I do this for a lot of both hard and soft buttons. I even deliberately change the button labels on the fly. And if there's hard buttons I even turn on/off little pointers in the UI layout to let the user know the hard button now does something else. this approach is entirely scaleable and allows for almost an endless variety of things a single button can do (or not do for that case) I use the same idea to disable a button if I don't want the user hitting it. I hope this helps.
No and thank goodness there isn't. It would be a mess. Each page on an R4 has a different set of buttons so you can just changes pages to use different channel numbers if need be. Alternatively you can keep the numbers as is, and depending on what's needed, run different code when its triggered. Changing channels dynamically will not make your life easier.
Paul
Imagine if the core processes had a notion of what was going on, instead of slavishly passing buttons into actions.
Like, if the system knew what source was selected in a particular room, giving context to any UI that was in charge of that room at the moment. So the UI would only every have to say "PLAY" and the system would apply that action to whatever the context demanded, instead of sorting through what page the ui was on and manhandling the hard button input to keep up.
I bet that such an architecture would also be able to easily share what rooms were in use, with what sources, should that matter to a user. Maybe even avoid conflicts automatically. Among other things.
Throw in a database of devices to define what "Play" means to each, and how to reach them (IR? SERIAL? IP? RELAY?) to say that... and gee, you could "reprogram" the system dynamically by just changing pointers to different sources (or system devices) in data. Maybe even without rebooting.
Yeah. A big project. One that sounds familiar to some of us....