Mutliple touchpanels on one master
[Deleted User]
Posts: 0
I have recently finished a system that had 2 touch panels on one master, in which each master looked the same and acted the same but you were able to control them independently. I basically was in a hurry so i just doubled up on all the button events and on the feedback.
I was wondering if there was a preferred method or even an easier method to handle this event. I tried to use virtual TP's but that seemed to cause problems, and i also tried a TP array but maybe I just implemented it incorrectly not sure. Has anybody come across this before and if so how did you do it?
Thanks in advance for any advice,
tony
I was wondering if there was a preferred method or even an easier method to handle this event. I tried to use virtual TP's but that seemed to cause problems, and i also tried a TP array but maybe I just implemented it incorrectly not sure. Has anybody come across this before and if so how did you do it?
Thanks in advance for any advice,
tony
0
Comments
First, you'd define each panel: e.g.
dv_TP1 = 10001:1:0
dv_TP2 = 10002:1:0
Then, you would make an array as follows:
DEV TouchPanels[] = {dv_TP1,dv_TP2}
For all of your button events, you would include the array instead of a device:
Hope that helps.
devchan buttons1[] = {{tp1,1},{tp1,2}}
devchan buttons2[] = {{tp2,1},{tp2,2}}
if seemed when i wrote the button event the following away it didnt seem to work correctly:
button_event[buttons1]
button_event[buttons2]
{
push:{
var1 = get_last(buttons1)
var2 = get_last(buttons2)
if(var1 > 0) {var3 = var1}
else if(var2 >0) {var2 = var2}
switch(var3)
{
}
var1 = var2 = var3 = 0
}
}
and it always seem to only go into the virst if statment everytime. this is how i wrote it until i just gave up because of time and seperated each button event. am i missing something on way it always hit the first condition statement?
That way you can do something like this
dvTP is an array of Touchpanels and buttons is an array of integers indicating channel numbers.
Button_Event[dvTP,buttons]
{
Push:
{
Switch(GetLast(buttons))
{
Case 1:{Send_command dvTP[GetLast(dvTP)],"'PAGE-1'"}
Case 2:{Send_command dvTP[GetLast(dvTP)],"'PAGE-2'"}
}
}
}
Button_Event[dvTP,buttons]
{
Push:
{
stack_var integer iButton, iTp
iTp = GET_LAST(dvTP)
iButton = GET_LAST(buttons)
Switch(iButton)
{
Case 1:{Send_command dvTP[iTp],"'PAGE-1'"}
Case 2:{Send_command dvTP[iTp],"'PAGE-2'"}
}
}
}
Blah!
shouldn't it be nTP and nButton if you're going to use prefixes :P
You should get Billy to teach that in Programmer I.....
http://www.acurazine.com/forums/images/smilies/finger.gif
Also, I don't think you can do "val1 = val2 = val3" in this language. I know you can in C, because the = operator returns a value, so that (val2 = val3) would set val2 to equal val3 and evaluate to val3, and you get val1 = (val3), etc. I'm not sure the = operator returns anything in NetLinx, correct me if I'm wrong.