TA Widget support different Text colors
-
@sato Yes you can do it, but it takes a little "trick". There are two ways to do it:
- Use double quotes for text (default). For example:
|TA UID:ta1 X:50 Y:50 TXT:"my text"\r\n @ta1 TXT:"<font color=\u0022red\u0022>my red text</font>"\r\n
In this case, the \u0022 is unicode escape for double quotes, which needs to be written like this, otherwise GUI-O will parse the TXT incorrectly when adding the 'font' color attribute.
- Use other character for TXT encapsulation (for example * - you have to set this via @gse request - see 'General settings change request' section in the manual):
|TA UID:ta1 X:50 Y:50 TXT:*my text*\r\n @ta1 TXT:*<font color="red">my red text</font>*\r\n
Note that instead of "red" you can use any hex color, e.g., #FFFF00.
This is not explicitly stated in the manual, so I will correct this.
BR,
kl3m3n -
@kl3m3n,
Good. Thanks.
How is the example code if the text is in a String Variable?Best regards
-
Could be something like this (after creating |TA with UID:ta1):
String var = "your_variable"; String message = "@ta1 TXT:\"<font color=\u0022red\u0022>" + var + "</font>\"\r\n";
in case of * delimiter:
String var = "your_variable"; String message = "@ta1 TXT:*<font color=\"red\">" + var + "</font>*\r\n";
BR,
kl3m3n -
Hi @kl3m3n,
This not work
text_line = "@ta1 TXT:"<font color=\u0022red\u0022>" + strnr + "</font>"\r\n";
mqttClient.publish(&In[0], &text_line[0]);show message String parameter header("></font>") not found
This not show error message, but not function correctly
text_line = "@ta1 TXT:<font color="red">" + strnr + "</font>\r\n";
mqttClient.publish(&In[0], &text_line[0]);It must show on the TA1 this:
13:13 13-07-2022 Ewald Weber
16:53 19-07-2022 Ewald Weber
18:15 24-07-2022 Klaus-Dieter Becker
10:18 27-07-2022 Tobias Wolf
17:48 15-08-2022 Hans Peters2
17:52 15-08-2022 Hans Peters3instaead it shows this:
*10:18
*
*17:48
*17:52
**
**
**Regards
-
@sato You are missing the escape character. Did this even compile?
Try (please try copy-paste) the following:
String var = "13:13 13-07-2022 Ewald Weber"; String message = "@ta1 TXT:\"<font color=\u0022red\u0022>" + var + "</font>\"\r\n"; mqttClient.publish(&In[0], &message[0]);
Best regards,
kl3m3n -
Hi @kl3m3n,
Yes, it compile. Have paste your code lines after create the TA. mqttClient.publish(&In[0], "|TA UID:ta2 X:84 Y:76 W:30 H:43 VIS:1 BGC:#b4c5de FGC:#121212 SHE:1 FSZ:4.5 RAD:1.5 BSZ:10 CL:1\r\n");
String var = "13:13 13-07-2022 Ewald Weber";
String message = "@ta2 TXT:"<font color=\u0022red\u0022>" + var + "</font>"\r\n";
mqttClient.publish(&In[0], &message[0]);but the App show String parameter header (">13:13 13-07-2022 Ewald Weber</font>") not found
Regards
-
Try escaping the \u0022 sequence using another slash, e.g.:
<font color=\\u0022red\\u0022>
Does this work ok?
Best regards,
kl3m3n -
Hello @kl3m3n,
Yes, now it works, congratulations. You are the best!It will be very useful to visually identify the two types of access, at the location where is the equipment and remotely away from the location. I will certainly use it when Gui-O makes the NFC tag ID available to the user.
Until then, I will wait.It could also be done via barcode, but it doesn't offer the same certainty since you could easily use a copy of that barcode.
Best regards
-
@sato Ok, I am glad it works now. The unicode sequence is parsed as double quotes, so it needs to be escaped again to not represent the actual escape sequence, but a backslash. GUI-O can then parse this correctly.
Thanks for the feedback.
Best regards,
kl3m3n -