Home AMX User Forum AMX General Discussion

Formatted text

Does anyone know how to send the formatted text string to a touch panel button from code? Sending $P won't work obviously. Tech support wasn't sure.
Paul

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    a_riot42 wrote: »
    Does anyone know how to send the formatted text string to a touch panel button from code? Sending $P won't work obviously.
    Sure it will. I assume you are referring to these formatting codes:
    Formatting codes can be used in the state text for bargraph and multi-bargraph buttons. The following formatting codes will be replaced with the identified values:
    $P - level percentage
    $V - raw level value
    $L - range low
    $H - range high
    $A - adjusted level value (raw level value ? range low)
    $R - range (range high ? range low)
    $$ - $ character
    Assign an address code to the button and do a text SEND_COMMAND using one or more of the formatting codes in the string.
  • a_riot42a_riot42 Posts: 1,624
    Joe Hebert wrote: »
    Sure it will. I assume you are referring to these formatting codes:
    Assign an address code to the button and do a text SEND_COMMAND using one or more of the formatting codes in the string.

    I tried that and using send_command dvTP, "'^TXT-100,0,$P'" resulted in the the text $P showing up in the text field, not the precentage. Have you tried this? I haven't got it to work but perhaps I am doing something wrong. How does the TP know if the incoming string is a formatted code? I can't imagine it parses it for the codes and behaves accordingly but perhaps it does.
    Paul
  • Are you using a general button or a bargraph / joystick in your test, as those embedded codes are only for the later...
    Buy changing the text on a button (via a VT command) you can modify the codes on a button.
    When one of the Text Formatting Codes is encountered by the firmware it is replaced with the
    correct value. These values are derived from the following operations:

    Might also be worth trying the old @TXT command rather than ^TXT

    Send_Command dvTP "'@TXT,100,'$P'"
  • Joe HebertJoe Hebert Posts: 2,159
    a_riot42 wrote:
    I tried that and using send_command dvTP, "'^TXT-100,0,$P'" resulted in the the text $P showing up in the text field, not the precentage. Have you tried this?
    Yes, I tried exactly that and it showed the percentage and it showed it with a percentage sign if I send $P% as the text.
    a_riot42 wrote:
    I haven't got it to work but perhaps I am doing something wrong.
    Are you using a bargraph button and not a multi-state bargraph button? If you are then I think that?s your problem even though you?re not doing anything wrong. I?ve used the multi-state bargraph buttons before and it works fine but I just tried it now with the simple bargaph and I?m seeing what you?re getting. So there appears to be a bug or the help file is wrong. Use the multi-state bargraph button instead if your application sees fit.
  • a_riot42a_riot42 Posts: 1,624
    Joe Hebert wrote: »
    Yes, I tried exactly that and it showed the percentage and it showed it with a percentage sign if I send $P% as the text.


    Are you using a bargraph button and not a multi-state bargraph button? If you are then I think that’s your problem even though you’re not doing anything wrong. I’ve used the multi-state bargraph buttons before and it works fine but I just tried it now with the simple bargaph and I’m seeing what you’re getting. So there appears to be a bug or the help file is wrong. Use the multi-state bargraph button instead if your application sees fit.


    I am using a bargraph not a multistate bargraph. I will change it to a msbg and see if that works. Thanks!

    EDIT: Yes it looks like the msbg is ok, but the regular bg doesn't work correctly unless that is by design.
    Paul
Sign In or Register to comment.