Page 1 of 1

How to center variable width String Meter?

Posted: February 20th, 2023, 7:01 pm
by NewStorm
Okay I'm super new in this, so sorry if this is a stupid/badly explained question 🙈
So I've got a String Meter - it's text input is variable (i.e. changes automatically from, say, 40 to 60 characters every 5min), meaning that the length of the string changes, too.
What I want is that "X" coordinate is always centered automatically (in regards to other meters), whenever string's length changes?ALL WHILE TEXT REMAINS ALIGNED TO THE LEFT - i.e. if I do "StringAlign=Center", all of the string text gets centred. I assume this would require to put string inside a shape that is always centered while the string inside remains aligned to the left. But then the question is how to adjust the shape's width and/or height automatically in order to match that of the string inside? Something like this, hopefully it makes sense 😭:
text.jpg

Re: How to center variable width String Meter?

Posted: February 20th, 2023, 8:47 pm
by ikarus1969
NewStorm wrote: ↑February 20th, 2023, 7:01 pm Okay I'm super new in this, so sorry if this is a stupid/badly explained question 🙈
So I've got a String Meter - it's text input is variable (i.e. changes automatically from, say, 40 to 60 characters every 5min), meaning that the length of the string changes, too.
What I want is that "X" coordinate is always centered automatically (in regards to other meters), whenever string's length changes?ALL WHILE TEXT REMAINS ALIGNED TO THE LEFT - i.e. if I do "StringAlign=Center", all of the string text gets centred. I assume this would require to put string inside a shape that is always centered while the string inside remains aligned to the left. But then the question is how to adjust the shape's width and/or height automatically in order to match that of the string inside? Something like this, hopefully it makes sense 😭:
text.jpg
Assuming 500 is the position for centering the left-aligned text you have to code on the text-meter a x-position like that:
X=(500 - 0.5 * [[#CURRENTSECTION]:W])

edit

Code: Select all

[Meter_To_Center_Left_Aligned]
Meter=STRING
Text=#VARIABLE_WITH_CONTENT#
X=(500 - 0.5 * [[#CURRENTSECTION]:W])
Y=10
StringAlign=LEFT
AntiAlias=1
DynamicVariables=1

Re: How to center variable width String Meter?

Posted: February 21st, 2023, 7:42 am
by NewStorm
It worked! Thank you!!

Re: How to center variable width String Meter?

Posted: February 21st, 2023, 2:24 pm
by ikarus1969
NewStorm wrote: ↑February 21st, 2023, 7:42 am It worked! Thank you!!
You're welcome!