Home AMX User Forum NetLinx Studio

Multiple Panels

Hello, hello, hello!!!

Any recommendations on how to handle two panels, one being a MVP8400 and the other an iPad? Both will have identical layouts and control abilities.

This is the first time I've had a situation where both panels will be identical and therefore would like to optimize my code. I've seen multiple threads related to this issue, but none address the iPad or give a clear answer.

Any advice?

Comments

  • jjamesjjames Posts: 2,908
    If the two panels are identical and the code they operate are identical, then using a DEV array could be a very easy solution. Instead of...
    button_event[dvTp1,1]
    {
     // stuff for the 8400
    }
    
    button_event[dviPad,1]
    {
     // stuff for the iPad
    }
    
    You can simply do something like this:
    define_constant
    dev dv_tp[] = {dvTp1, dviPad}
    
    define_event
    button_event[dv_tp,1]
    {
     // This event handles both touch panels
    }
    
    Since dv_tp is an array, you can use get_last() on it to figure out which one triggered the event just in case you want to do anything special.
    button_event[dv_tp,1]
    {
     push:
     {
      stack_var integer index;
      index = get_last(dv_tp);
      
      if(index == 1)
      {
       // Do something for the 8400 only
      }
      else if(index == 2)
      {
       // do something for the iPad only
      }
     }
    }
    

    You can send each panels to a specific page by doing something like this:
    send_command dv_tp[1],"'PAGE-Welcome 8400'";
    send_command dv_tp[2],"'PAGE-Welcome iPAD'";
    
    or if you want to send them both to the same page
    send_command dv_tp,"'PAGE-Welcome'";
    

    Hope this helps!
  • Thanks so much!!! I really appreciate the code samples too.

    I had been thinking of going with an array, but some other threads kept talking about virtual panels.

    Any reason why I should think about using a virtual panel?

    Thanks!!!
  • jjamesjjames Posts: 2,908
    Thanks so much!!! I really appreciate the code samples too.

    I had been thinking of going with an array, but some other threads kept talking about virtual panels.

    Any reason why I should think about using a virtual panel?

    Thanks!!!

    I highly suggest you do not go the route of virtual panels, as if you ever need to separate them, you'll just find yourself in a rut. I like to maintain expandable, and using virtual panels / combine_devices is not very coder friendly. I think the last time I used a virtual panel was before I had any training.
  • Sounds good. I'll stick with the array!

    THANKS SO MUCH FOR YOUR TIME!!!
Sign In or Register to comment.