Creating Buttons

Tips and Tricks from the Rainmeter Community
User avatar

Creating Buttons

April 28th, 2009, 4:19 pm
jsmorley
Developer   [15895 posts]

This is about how to create the button images you use in Rainmeter with code like this:

[MeterSample]
Meter=BUTTON
X=1
Y=1
ButtonImage=MyButton.png
ButtonCommand=!Execute ["SomeCommand"]

Buttons are a special kind of Meter in Rainmeter, and require a special kind of image. Rainmeter, like Windows, wants a button to have three "states". "UP", "DOWN" and "OVER", or "When your mouse isn't on the button", "When you are clicking on the button" and "When you are hovering over the button".

Create the images in Photoshop, Gimp, Paint.NET, whatever you like. It's VERY helpful if the tool has the capability to create "layers" however.

Create a new image with a transparent background which has the "HEIGHT" of the image you want for the button, and a "WIDTH" which is three times the width of the image. This is because Rainmeter will want to find three horizontal versions of the image in the file; one for "UP", one for "DOWN" and one for "OVER" - in that order.

Image

Each of the layers can have a different visual appearance (and positioning if you want the button to "move" when clicked) so that when you use the button it is clear what state the button is in. I desaturated the "DOWN" state and added a "lens flare" to my "OVER" state.

Save the image as a .png (for a transparent background) or .jpg (solid background)

When you use the button in your code, Rainmeter chooses the 1/3 of the overall image to display depending on the state of the button.

Image UP

Image DOWN

Image OVER

Hope this is of some help for those just starting to look at buttons for your skins.
User avatar

Re: Creating Buttons

April 28th, 2009, 4:53 pm
sgtevmckay
Developer   [1317 posts]

There was someone asking about this earlier in the forum, I will have to find them and link it to here.

You definitely cut to the chase, the tut I was working on to explain, was getting way too wordy.

I also notice you apparently use Photoshop.
User avatar

Re: Creating Buttons

April 28th, 2009, 5:03 pm
jsmorley
Developer   [15895 posts]

sgtevmckay wrote:There was someone asking about this earlier in the forum, I will have to find them and link it to here.

You definitely cut to the chase, the tut I was working on to explain, was getting way too wordy.

I also notice you apparently use Photoshop.


There is Photoshop and then there is everything else... ;-)
User avatar

Re: Creating Buttons

April 28th, 2009, 5:10 pm
sgtevmckay
Developer   [1317 posts]

agreed; to a point.

I work with numerous graphics, and I find that when I get into a large project, i tend to end up using several editors/layouy designers; Ps3, Illustrator, InDesign, Premier, Gimp, Paintshop Pro, and believe it or not, I do rough drafts in Office Publisher.

And at times I get requests/contracts for web design and maintenance, and the Adobe collection really comes to Life :D
User avatar

Re: Creating Buttons

April 28th, 2009, 5:17 pm
jsmorley
Developer   [15895 posts]

I have found that Adobe does the job for me in just about all cases.. Photoshop CS4 for images, Illustrator CS4 for vector graphics, Flash CS4 for flash stuff, Dreamweaver CS4 for prototyping web pages. (I prototype in Dreamweaver, but code it in UltraEdit, I prefer hand coding)
User avatar

Re: Creating Buttons

April 28th, 2009, 5:26 pm
sgtevmckay
Developer   [1317 posts]

Nice.

I have not yet been able to come up with the cash to upgrade my AMC Cs3 yet. I hope to soon, but damn!

I got lucky when it came time to upgrade to Cs3, and landed a major contract which floated the bill (which I promptly wrote off at the end of the year), but I have yet to land "that" contract this time around :cry:

All things in time :D
User avatar

Re: Creating Buttons

April 28th, 2009, 5:45 pm
jsmorley
Developer   [15895 posts]

sgtevmckay wrote:Nice.

I have not yet been able to come up with the cash to upgrade my AMC Cs3 yet. I hope to soon, but damn!

I got lucky when it came time to upgrade to Cs3, and landed a major contract which floated the bill (which I promptly wrote off at the end of the year), but I have yet to land "that" contract this time around :cry:

All things in time :D


CS3 is perfectly fine for 99.999% of things. There isn't that much new in CS4 that you can't live without.
User avatar

Re: Creating Buttons

April 28th, 2009, 6:17 pm
sgtevmckay
Developer   [1317 posts]

Cool

thanks for the info :ugeek:

I just hate missing out the latest toys :D

Re: Creating Buttons

June 12th, 2009, 11:41 pm
r3ginald
   [13 posts]

can you show me what the code would look like if you were to do the "up", "down", and "hover" ?
User avatar

Re: Creating Buttons

June 13th, 2009, 12:17 am
jsmorley
Developer   [15895 posts]

r3ginald wrote:can you show me what the code would look like if you were to do the "up", "down", and "hover" ?


[MeterSample]
Meter=BUTTON
X=1
Y=1
ButtonImage=MyButton.png
ButtonCommand=!Execute ["SomeCommand"]

That's it... "you" don't do the Up, Down and Over, Rainmeter does it automatically. You just need to put the button on a meter and define what you want to have happen when it is clicked.

Return to “Community Tips and Tricks”



Who is online

Users browsing this forum: No registered users and 1 guest