Panels are combined, but I need one separate function
fogled@mizzou
Posts: 549
I have 2 TPI4 panels, and have them combined with a virtual device. This is working fine, except now I've run into one instance where I need to tell which panel a button click is coming from, and provoke a different popup page depending on which panel it comes from (sigh).
When I trap for a button_event on TP1 or TP2, I get nothing. When I trap for VirtualTP, I see the button event. When I watch the device notifications, I see a button event coming from TP1 or TP2, then coming from the VirtualTP, but the program doesn't pick up the button event from the individual panels.
Is there any way to sense which panel the button event is coming from when the panels are combined, without ripping apart all my combined stuff and reprogramming for separate panels? Please?
Thanks,
When I trap for a button_event on TP1 or TP2, I get nothing. When I trap for VirtualTP, I see the button event. When I watch the device notifications, I see a button event coming from TP1 or TP2, then coming from the VirtualTP, but the program doesn't pick up the button event from the individual panels.
Is there any way to sense which panel the button event is coming from when the panels are combined, without ripping apart all my combined stuff and reprogramming for separate panels? Please?
Thanks,
0
Comments
--D
But that doesn't work for feedback (i.e. on[Tp,1]), does it? Don't I end up having to run through the Tp array for feedback? ... and yeah, I know that's not quite the right syntax; I'll have to go look it up.
Sure Does.
ON[TP,1] will turn on channel 1 on ALL of the Panels defined in the array.
how is this possible? how can you trap BUTTON_EVENTs for the virtual combined device then?
That's right. But now I remember why I combined the panels to begin with, instead of using an array. I could not get DVD or CD system calls to work with the panel array. When I combined the panels into a virtual panel, the DVD and CD system calls worked OK.
So now I need to ask: should a DVD system call work with a panel array? When I use a device array of panels, I get a compile error of "Type mismatch in call for parameter [PANEL]" in whereas this works OK when I have dvPANELS defined as a combined virtual device.
If anyone can tell me how to get around this one glitch with the system call, I can convert over to using the device array and all will be good.
I don't recall having done this with system calls exactly, but I have used that method to overcome other similar compile errors with success.
This was what I was going to try anyway, and I'm rolling out the code update tomorrow afternoon. I'm just a little nervous about the feedback working correctly. I'll post back and let everyone know how it went.
As for the combined virtual panel vs individual panels, I have no explanation why I can see the individual panel's button event show up in the Device Notifications, but only button events that look at the virtual combined panel actually trigger from the button event. But AMX's documentation indicates this - that the code only 'sees' the button event from the combined panel.
If you have only one button that's different out of the two panels, perhaps putting that button on a different port of the touchpanel would work.
I'm assuming you've only say combined 128:1:0 and 132:1:0 and thus could put the different button on 128:2:0 and 132:2:0.
The only common thing I can discern between feedback commands that work and ones that don't is that if I have a stack of button events and then a switch/case to trap the specific buttons, either the feedback works for that entire stack, or it doesn't. But in both cases, the code is essentially the same.
This makes absolutely no sense at all. If I use a virtual panel and combine the touchpanels that way, the feedback always works correctly on both panels.
So, what's a guy to do? Why doesn't the feedback work consistenly with a device array?
I use panel arrays in every program (even when there's only one panel), and I've never run across a situation where the feedback didn't work on all of the panels. However, I don't use system calls much (ever), so I can't comment on how arrays might or might not work with them.
--D
The only time I've ever had issues is when something else, somewhere else in the code was working against me.
I don't doubt that it's something else in my code working against me, although I haven't pinned down what yet. I've never had problems using panel arrays before. But I can switch back and forth between a combined virtual device and a device array by changing 4 lines of code, and I always get the same result: some sets of buttons won't get feedback on the first device in the device array (and I've swapped which device is first and last to verify it's not just one or the other, but always the first that fails and the last that works), but all buttons always get feedback when using a combined virtual panel. So I'll work through a few things - commenting out sections of code at a time - to see if I can pin down the problem.
If it turns out to be the system calls for DVD/VCR control, is there a repository of code that will control a DVD/VCR without using the built-in system calls?
So I make an array of numbers, 1-100. Then I make a BUTTON_EVENT for the device that looks something like this:
On the touch panel screens, the buttons have the same channel as the IR code they are to send. So, for a standard PLAY IR, which is indexed as channel 1, the play button will also be channel 1. Of course, this is a bit simplified, sometimes you need to do some tests because not all devices behave the same (some need you to hold FWD to scan forward, some are single press, etc.). But that's the gist of it. If the device changes and the IR codes are different, you can just load the new IR and edit the panel itself, no need to change any code. I generally edit IR files so everything is under channel 100, but you could as easily expand the array instead if you dedicate the panel port.
Do something similar to what Dave suggest or what ever floats your boat.
Sorry to bring up an old thread, but I realized I found an answer to this a while ago and it works really well: BUTTON.INPUT.DEVICE and BUTTON.INPUT.DEVICE.NUMBER. Vining pointed this out in a post, but I missed it at the time.
I can pass the DEVICE (or it's NUMBER index) off to a call or function and I know which panel the button push came from, and provoke the correct popups (and feedback) on the appropriate panels accordingly.
At this point, I definitely agree with the advice to use panel arrays rather than combining panels, and roll your own control/feeback of IR-based DVD/VCR's instead of relying on system calls.
Woo-hoo! You've seen the light!
Happy hacking!