It is currently April 19th, 2024, 2:43 pm

Aligning image to Left of Center String

Get help with creating, editing & fixing problems with skins
User avatar
Melancholyway
Posts: 11
Joined: October 11th, 2015, 4:50 pm

Aligning image to Left of Center String

Post by Melancholyway »

Hi. I can't seem to figure out how to align an image meter to the left of a string meter that changes width often and is center aligned. It just aligns relative to the X=200 value and not the actual left of the text. How can I do this?

Code: Select all

[Description]
MeasureName=MeasureDescription
Meter=STRING
MeterStyle=Weather
StringStyle=Bold
StringAlign=Center
X=200
Y=170
FontSize=15

[Icon]
Meter=IMAGE
ImageName=#@#Icon.png
X=-30r
Y=0r
W=24
H=24
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Aligning image to Left of Center String

Post by Active Colors »

Code: Select all

[Icon]
X=([Description:X]+[Description:W])
DynamicVariables=1
You can substract or add some space between your string meter and image by adding some numeric value inside the bracets. For example X=([Description:X]+[Description:W]+10)
User avatar
Melancholyway
Posts: 11
Joined: October 11th, 2015, 4:50 pm

Re: Aligning image to Left of Center String

Post by Melancholyway »

Thanks for that. I completely forgot about :W. That doesn't work for aligning with the left of the text though but this did:

Code: Select all

X=([Description:X]-([Description:W]/2))
Thanks again.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Aligning image to Left of Center String

Post by Active Colors »

Another way of doing it is to set R for your Icon meter's X. As I see you already know that r places the meter relatively to previous meter's starting point, so R is same but places the meter to end point of previous meter.
But since your text is centered, you will need to dived it's width by half, so it will look like

Code: Select all

X=([Description:W]/2)R
Anyway I should say that the first method I posted is more practical if your meters are not placed one after another.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Aligning image to Left of Center String

Post by Active Colors »

Oh, misread your post. I thought you wanted to put your image meter on the end of the string meter.
Melancholyway wrote:Thanks for that. I completely forgot about :W. That doesn't work for aligning with the left of the text though but this did:

Code: Select all

X=([Description:X]-([Description:W]/2))
Thanks again.
This will actually place your meter incorrectly. Insted of dividing Description meter by half you should substract your image meter's width.

Code: Select all

X=([Description:X]-([Icon:W])
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Aligning image to Left of Center String

Post by Mor3bane »

This was VERY useful :thumbup:
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.