Cant get ST77xx <taskname>#length to work

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Affinite
Normal user
Posts: 152
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Cant get ST77xx <taskname>#length to work

#1 Post by Affinite » 08 Jan 2025, 17:09

Im trying to centre a clock on a TFT using the example rules in ST77xx plugin notes
It doesnt work correctly and its because taskname>#length isnt working (for me).

I've simplified my rules below but I still only get value of 1 returned when I try to measure the length of the text string
Any ideas ?

Code: Select all

on displayhome do
  Touch,Setgrp,1
  tft,clear,black
  tft,txs,3
  let,121,[TFTpanel#length."text to measure"]
  let,122,[TFTpanel#width]              
  let,123,([TFTpanel#width]-[TFTpanel#length.%systm_hm%])/2      // (width - textlength)/2
  tft,txtfull,[int#123],100,3,red,black,%systm_hm%  // Display time red on black
endon
When I look at my system variables screen I see
%v121% = 1
%v122% = 480
%v123% = 240

I notice that in the rules editor "TFTpanel#length" is in black wheras "TFTpanel#width" is Red.
Does this mean the variable "TFTpanel#length" is inactive ?
I must have done something wrong - but I cant see it !

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Cant get ST77xx <taskname>#length to work

#2 Post by Ath » 08 Jan 2025, 20:52

Well, congratulations!, you've actually found a tiny bug :lol:
You used the, documented, period as the separator between length and the value to take the length of, but during development we decided to change the separator there from the original comma to a period. That was changed where needed, except for the length and textheight subcommands... :?

I've fixed the code, that'll take some time to get merged and released, but for now you can change the period to a comma and it should work as expected.
Also fixed to return 0 when no text argument is provided, instead of a somewhat random value.
/Ton (PayPal.me)

Affinite
Normal user
Posts: 152
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Cant get ST77xx <taskname>#length to work

#3 Post by Affinite » 08 Jan 2025, 23:18

:D

Affinite
Normal user
Posts: 152
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Cant get ST77xx <taskname>#length to work

#4 Post by Affinite » 09 Jan 2025, 12:52

Thx ton
shame it doesnt work on the proportionately spaced fonts. The mono spaced fonts are pretty ugly :(

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests