It is currently October 5th, 2024, 5:00 pm

Creating Buttons

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 22819
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Creating Buttons

Post by jsmorley »

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.
sgtevmckay

Re: Creating Buttons

Post by sgtevmckay »

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
jsmorley
Developer
Posts: 22819
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

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... ;-)
sgtevmckay

Re: Creating Buttons

Post by sgtevmckay »

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
jsmorley
Developer
Posts: 22819
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

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)
sgtevmckay

Re: Creating Buttons

Post by sgtevmckay »

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
jsmorley
Developer
Posts: 22819
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

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.
sgtevmckay

Re: Creating Buttons

Post by sgtevmckay »

Cool

thanks for the info :ugeek:

I just hate missing out the latest toys :D
r3ginald
Posts: 12
Joined: June 12th, 2009, 6:45 pm
Location: California

Re: Creating Buttons

Post by r3ginald »

can you show me what the code would look like if you were to do the "up", "down", and "hover" ?
My Tumblog
Everything I have made is located at my blog. Visit for my latest updates, skins, themes/etc.
-------------------------------------
TEAM V.I.S.O.R.
devART
User avatar
jsmorley
Developer
Posts: 22819
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

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.