It is currently April 28th, 2024, 6:44 am

meter width relative to other meters?

Get help with creating, editing & fixing problems with skins
Alex Becherer

meter width relative to other meters?

Post by Alex Becherer »

Image

this is what i am currently working on. a to-do-list skin that reads atom-feeds from Remember The Milk. works great. tasks can have different priorities at Remember The Milk.

the priorities are represented looking like a text marker. different colors for different priorities, or an empty png for no priority. works great.

my problem: i would like to the image meter of the priority to have the same width as the string meter of the task. is that possible?
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: meter width relative to other meters?

Post by MerlinTheRed »

I think you'll have to use a Lua script for this. The Lua script would get the width of the string meter and set the width of the image meter behind it accordingly. It's very likely that this will only work if you haven't defined a width for those string meters. If you have (to prevent long text from flowing outside the box), you could calculate the width you need from the number of letters in the text. Of course this will be less accurate.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
Alex Becherer

Re: meter width relative to other meters?

Post by Alex Becherer »

thanks. this is what i was afraid of. i probably had some old LiteStep module in mind that was able to to do sizes of labels relative to other labels. i don't speak Lua so i probably leave this part of the skin as it is.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: meter width relative to other meters?

Post by Kaelri »

Don't be discouraged! Lua is easy to learn. In fact, what you need would be pretty simple. Given two example meters, [TaskItem] (the text) and [TaskBackground] (the image):

Code: Select all

function Update()
    Meter = SKIN:GetMeter('TaskItem')
    Width = Meter:GetW()
    SKIN:Bang('!SetOption', 'TaskBackground', 'W', Width)
end
And that's it.
Alex Becherer

Re: meter width relative to other meters?

Post by Alex Becherer »

wow, didn't think it would be that easy.

it worked! thanks a lot.