Home AMX User Forum NetLinx Studio

Stack events

Hi

I would like to know, when we have 2 or more touch panel in the same projetc, each touch panel have some common devices, if it's better to do differents program for each panel or if we can stack buttons event

ex:

BUTTON_EVENT [dvTP_STORES_PISCINE,4]
BUTTON_EVENT [dvTPK_STORES_PISCINE,4]

or complete program for each button of each device

Comments

  • The best, IMHO, is to delcare a DEV array containing both panels:
    DEFINE_DEVICE
    
    TP1 = 10001:1:0
    TP2 = 10002:1:0
    
    
    DEFINE_VARIABLE
    
    TPs[] = {TP1,TP2}
    
    
    DEFINE_EVENT
    
    BUTTON_EVENT [TPs,1]
    { PUSH:
      {
        // This will trigger if button ch. 1 is pushed on either channel
      }
    }
    
    DEFINE_PROGRAM
    
    [TPs,1] = [SomeDevice,PowerOn]  // This will light up the button on BOTH panels when channel 'PowerOn' on 'SomeDevice' is on
    

    You can still address panels separately:
    BUTTON_EVENT [TP1,2]
    { PUSH:
      {
         // Only triggers for TP1
      }
    }
    
    BUTTON_EVENT [TP2,2]
    { PUSH:
      {
        // Only triggers for TP2
      }
    }
    

    - Chip
  • frthomasfrthomas Posts: 176
    Denis wrote:
    I would like to know [...] if it's better to [..]

    Internally all forms resolve to the same code, so the better way is the one you like best and find the most easy to maintain.

    Chip's method has the great advantage of scalability: just add the panel to the dev array and voila! (for the shared buttons at least).

    However, I do find that "overusing" dev arrays and channel arrays and other arrays may sometimes lead to code not easily grasped unless you're firmly into it, the kind you look at 6 months later and wonder what this is trying to achieve. So I would not bother if few functions are shared.

    Fred
Sign In or Register to comment.