Home AMX User Forum NetLinx Studio

Panel Commands

Hey all,

I'm relatively new to programming AMX, but not to programming as a whole, so I understand how things work from that end. Presently, however, I'm trying to do some testing in which sending button commands to some panels are involved - simple enough, right?

I'm running into the problem that when I use the following syntax:
SEND_COMMAND dvTPANELS[LAST_PANEL],"'@TXT',SOMEBUTTON,'Some Text'"
...It works just fine. However, when I do this:
SEND_COMMAND dvTPANELS[LAST_PANEL],"'^TXT',SOMEBUTTON,2,'Some Text'"
- that syntax does not work for me. Furthermore, I have the same problem when trying to use the ^BMF command to disable and hide some buttons.

At this point, I thought to myself that the syntax I was dealing with might be old; perhaps new commands use the "@" character. Problem is, when I went to find something new in AMX PI, I found nothing; not only that, but I couldn't even find the @TXT command in any of the Touch Panel documentation - which is the only command I can get working.

...Help! :)

Comments

  • HedbergHedberg Posts: 671
    ...
    ...It works just fine. However, when I do this:
    SEND_COMMAND dvTPANELS[LAST_PANEL],"'^TXT',SOMEBUTTON,2,'Some Text'"
    
    - that syntax does not work for me. Furthermore, I have the same problem when trying to use the ^BMF command to disable and hide some buttons.

    I think I see the problem. Look very carefully at the documentation and you will see that the entire "Command" is a string. The 2 (and the commas around it), which indicates the state, needs to be a string as well. So, this should work:
    send_command dvTP, '^TXT-123,2,TEXT'
    
    also this
    sSomeButton = "itoa(nButtonNumber)"
    
    SEND_COMMAND dvTP,"'^TXT-',sSomeButton,',2,','Some Text'"
    

    So, the use of the command is a little goofy in that everything, including the punctuation, needs to be part of the string, and integers need to be characters, not integers.
  • slip couganslip cougan Posts: 34
    You can do this as well:

    SEND_COMMAND dvTPANELS[LAST_PANEL], "'^TXT-',ITOA(buttonLow),'.',ITOA(buttonHigh),',',ITOA(buttonState),',',Some more text)"

    regards

    gary
  • BigsquatchBigsquatch Posts: 216
    At this point, I thought to myself that the syntax I was dealing with might be old; perhaps new commands use the "@" character. Problem is, when I went to find something new in AMX PI, I found nothing; not only that, but I couldn't even find the @TXT command in any of the Touch Panel documentation - which is the only command I can get working.

    ...Help! :)

    The @TXT command documentation can be found in the info for G3 panels. @TXT is actually the older 'outdated' command but it still works with G4 panels.
  • a_riot42a_riot42 Posts: 1,624
    Hedberg wrote: »
    sSomeButton = "itoa(nButtonNumber)"

    SEND_COMMAND dvTP,"'^TXT-',sSomeButton,',2,','Some Text'"[/code]

    I don't think that will work Harold. Did you mean this?
    sSomeButton = "itoa(nButtonNumber)"
    send_command dvTP,"'^TXT-',sSomeButton,',',itoa(2),',','Some Text'"
    
  • Joe HebertJoe Hebert Posts: 2,159
    Originally Posted by Hedberg
    sSomeButton = "itoa(nButtonNumber)"

    SEND_COMMAND dvTP,"'^TXT-',sSomeButton,',2,','Some Text'"
    a_riot42 wrote: »
    I don't think that will work Harold. Did you mean this?
    sSomeButton = "itoa(nButtonNumber)"
    send_command dvTP,"'^TXT-',sSomeButton,',',itoa(2),',','Some Text'"
    
    Unless I'm reading it wrong, the code that Hedberg posted looks fine to me. He's got the 2 inside of single quotes so it's already ASCII.
  • a_riot42a_riot42 Posts: 1,624
    Joe Hebert wrote: »
    Unless I'm reading it wrong, the code that Hedberg posted looks fine to me. He's got the 2 inside of single quotes so it's already ASCII.


    I was thinking it was more the commas that were the issue, but you are right, he has the commas on either side of the 2 so ,',2,', is correct. I was fooled since I don't usually write it that way. I keep my commas separate from the string in case it gets changed from a hard coded value to an interpolated value like so.
    send_command dvUis[ui], "'^TXT-',itoa(zoneChannel),',',itoa(0),',',cZoneDesc[iRoomZones[room][j]]"
    

    Believe it or not I find that easier to read :)
    Paul
  • Joe HebertJoe Hebert Posts: 2,159
    a_riot42 wrote: »
    Believe it or not I find that easier to read :)
    Different strokes for different folks, you won?t get an argument from me. :)
  • Definitely appreciate everyone's help; I got the issue resolved.

    While I'm asking syntax questions, however, I do have one more inquiry into the collective forum mind... :)

    Is there a way to tag a keyboard/keypad string with a custom prefix? For example, have the string from the keyboard return with 'KEYB-2:Stuff from keyboard'? Alright, technically that's a suffix, but you know what I mean. :D

    Thanks y'all!
  • filpeefilpee Posts: 64
    Yes.

    In TP4 click File then Open System Page Template

    Copy the __keyboard or __keypad and name the new one MyCustomKeyPad or whatever you want.

    in this new keyboard/keypad that you have created click on the text box and rename KEYB- to AMXKeyB-.

    Then instead of using the inbuilt open keyboard command you just use a PPON-MyCustomKeyPad to open your custom keypad.

    Make as many as your touchpanel can support.
  • Vielen Dank, filpee, and Last question (potential lie):

    Does the keypad/keyboard send the string specifically to that device and port? Say there's multiple touch panels; does the string go to the master, and therefore the panel which sent the string needs to be tracked, or will the string show up within the DATA_EVENT for that specific panel?

    Thanks!
  • filpeefilpee Posts: 64
    It will show in the data_event for each individual panel
Sign In or Register to comment.