Home AMX User Forum NetLinx Studio

Sending Text to a Button

I can send any text onto a particular button by the command used in Netlinx

SEND_COMMAND Panel,"'^BAT-520,1,Enter City'"

Now I want to send the text in a char variable instead of the direct text, How the syntax will change?

Please helpme

Comments

  • arunmohan wrote: »
    SEND_COMMAND Panel,"'^BAT-520,1,Enter City'"

    Now I want to send the text in a char variable instead of the direct text, How the syntax will change?

    You would simply put your char variable in place of "Enter City"

    SEND_COMMAND Panel,"'^TXT-520,1,cVariable'"

    Also:

    SEND_COMMAND Panel,"'^TXT-520,0,cVariable'"

    Will display the text in all states of the button... on, off, etc.
  • jjamesjjames Posts: 2,908
    ^BAT appends text to a variable text button. If you ONLY send it once (ever), it will work, otherwise use ^TXT.
  • jjames wrote: »
    ^BAT appends text to a variable text button. If you ONLY send it once (ever), it will work, otherwise use ^TXT.

    Oops! I didn't even notice that!
  • HedbergHedberg Posts: 671
    You would simply put your char variable in place of "Enter City"

    SEND_COMMAND Panel,"'^TXT-520,1,cVariable'"

    Also:

    SEND_COMMAND Panel,"'^TXT-520,0,cVariable'"

    Will display the text in all states of the button... on, off, etc.

    My experience with ^TXT is that it is a comma delimited string and that in the form you have it, the text that will be sent to the button is the string 'cVariable'. Do I have this wrong? I don't have a touch panel to check it with right now.

    I think what you need to do to use ^TXT with a variable argument is something like:

    SEND_COMMAND Panel,"'^TXT-520,0,',cVariable"

    I think to use the ^BAT form (if appropriate) you'd need something like:


    SEND_COMMAND Panel,"'^BAT-520,1,',cVariable"

    which is sort of funky looking because you have the two commas together -- one as part of the string and one as a delimiter.
  • jjamesjjames Posts: 2,908
    You are correct. It's difficult to read things here on the forum without proper formatting. TXT & BAT commands are like so:

    ^TXT-<address> , <state> , <text>
    ^BAT-<address> , <state> , <text>
    Where:
    <address> is the variable text address of the button intended for the text
    <state> is both, off or on (0, 1, 2 respectively OR states 1 - 256 for multi-state buttons)
    <text> is the text meant to be on the button, whether it be a variable or static text (up to 50 chars per AMX-PI)

    ^BAT appends text to a button. So if you wanted your button to say "This is silly", you could do this:
    send_command dvPanel1 , '^BAT-520 , 0 ,This '
    send_command dvPanel1 , '^BAT-520 , 0 ,is '
    send_command dvPanel1 , '^BAT-520 , 0 ,silly '
    // Variable text button reads "This is silly"

    ^BAT is helpful when hitting that magic text length when sending to a panel (which I *thought* was 188 characters, though I've seen some people say 200 and AMX-PI say 50 . . .)

    Just like Google, AMX-PI is your friend (except when it's wrong.)
  • You would simply put your char variable in place of "Enter City"

    SEND_COMMAND Panel,"'^TXT-520,1,cVariable'"

    Also:

    SEND_COMMAND Panel,"'^TXT-520,0,cVariable'"

    Will display the text in all states of the button... on, off, etc.



    No. it wont work.
  • Spire_JeffSpire_Jeff Posts: 1,917
    arunmohan wrote: »
    No. it wont work.

    See the post after the one you quoted. The command you are trying to use is slightly wrong. Look at the ' and , below.

    Try:
    Hedberg wrote:
    I think what you need to do to use ^TXT with a variable argument is something like:

    SEND_COMMAND Panel,"'^TXT-520,0,',cVariable"

    I think to use the ^BAT form (if appropriate) you'd need something like:


    SEND_COMMAND Panel,"'^BAT-520,1,',cVariable"

    Jeff
  • Spire_Jeff wrote: »
    See the post after the one you quoted. The command you are trying to use is slightly wrong. Look at the ' and , below.

    Try:


    Jeff

    Thanks Hedberg, Thanks Spire_Jeff..... I'll let u know if it is working.
  • Thanks Guys

    This will work.
    SEND_COMMAND Panel,"'^BAT-520,1,',cVariable"

    Thank u all.
  • HedbergHedberg Posts: 671
    arunmohan wrote: »
    This will work.
    SEND_COMMAND Panel,"'^BAT-520,1,',cVariable"

    Thank u all.

    Good.

    Do you see why it works and why
    "'^BAT-520,1,cVariable'"
    does not give you the result you want?

    There is a metric buttload of lessons about strings in this little example.

    Well, maybe only a half metric buttload, but it's important to understand.
  • Hedberg wrote: »
    Good.

    Do you see why it works and why
    "'^BAT-520,1,cVariable'"
    does not give you the result you want?

    There is a metric buttload of lessons about strings in this little example.

    Well, maybe only a half metric buttload, but it's important to understand.

    Sure, I'll.
  • udiudi Posts: 107
    Communication between IPad and ni-3100

    I have a problem to communicate between the iPad and the ni-3100. When I contact to the tpcontrol in the iPad and I press on the button it doesn't do anything (it even doesn't change color from red=press to yellow=release). In the netlinx I see that the iPad is online. I don’t know what the problem is.
Sign In or Register to comment.