It is currently September 20th, 2020, 7:50 pm

Creating Buttons

Tips and Tricks from the Rainmeter Community
Ao Nuu Shin
Posts: 128
Joined: May 2nd, 2015, 9:13 am

Re: Creating Buttons

Post by Ao Nuu Shin »

Ahahah thanks! And if that's the case, i think it's good right now, hey, i even added the "Chrome" name under it! 8-) i'm a hotshot, lol. Thanks again! I will try to create now more icons like that, and when it is finished, i will definitely share it on my DArt account and here also. Thank you all!!
User avatar
jsmorley
Developer
Posts: 21372
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

Glad to help. Have fun.
Ao Nuu Shin
Posts: 128
Joined: May 2nd, 2015, 9:13 am

Re: Creating Buttons

Post by Ao Nuu Shin »

Thank you all again! Really! And sorry for posting so many things together! Thank you, you are awesome!! Be well and happy!!
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: Creating Buttons

Post by Cellinarac »

I have a question for using images for buttons, say I want to use 3 totally separate image files (1.bmp, 2.bmp, 3.bmp) for one button, how would I go about writing the code for that?
Thanks.
Cellinarac
User avatar
balala
Rainmeter Sage
Posts: 11367
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Creating Buttons

Post by balala »

Cellinarac wrote:I have a question for using images for buttons, say I want to use 3 totally separate image files (1.bmp, 2.bmp, 3.bmp) for one button, how would I go about writing the code for that?
Thanks.
Supposing you don't want to create the image of the button (as it is described in jsmorley's first post of this thread), you should create the following image meter:

Code: Select all

[MeterButton]
Meter=Image
ImageName=#@#1.bmp
...
MouseOverAction=[!SetOption #CURRENTSECTION# ImageName "#@#2.bmp"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageName "#@#1.bmp"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseDownAction=[!SetOption #CURRENTSECTION# ImageName "#@#3.bmp"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!SetOption #CURRENTSECTION# ImageName "#@#1.bmp"]...ADD HERE THE NEEDED BANGS...[!UpdateMeter "#CURRENTSECTION#"][!Redraw]
I wrote the above code supposing 1.bmp is the basic image, which should be shown initially, 2.bmp is the image which you should see when you're hovering the mouse over the image / button and finally you should see the 3.bmp image, when you click. Don't forget the other needed / possible options.
Just as a side note, it's not the best idea to use bmp images. It's possible, however it's not desirable.
Also note that normally the same requirements apply to the three images, as those describes by jsmorley, in the above mentioned post.
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: Creating Buttons

Post by Cellinarac »

ok thanks, that works for me because, honestly its faster for me to make different images and then adjust color, contrast and other effects for each than to make them and try to perfectly align them into one image. I hate when the button moves, even the slightest and to me it's to tedious to try splitting it into perfect 1/3s using paint. I'm just picky like that I guess lol
Cellinarac
User avatar
jsmorley
Developer
Posts: 21372
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

Cellinarac wrote:ok thanks, that works for me because, honestly its faster for me to make different images and then adjust color, contrast and other effects for each than to make them and try to perfectly align them into one image. I hate when the button moves, even the slightest and to me it's to tedious to try splitting it into perfect 1/3s using paint. I'm just picky like that I guess lol
You might look at alternative 2 here: https://docs.rainmeter.net/tips/button-images/

Mind you, I'm not opposed to 3 images and an Image meter rather than a Button meter, but do be aware that using LeftMouseDownAction means you can't drag the skin if the cursor is on that image, since Rainmeter is intercepting the down state that Windows would use for dragging. Just be sure you have other places in the skin you can use for dragging, or you will need to hold down CTRL to do so.
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: Creating Buttons

Post by Cellinarac »

Awesome! ImageMagick it is then. Thank you so much!
Cellinarac
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: Creating Buttons

Post by Cellinarac »

ok, back with another problem with buttons... I have created about 10 for my desktop I have been working on, however I have come across yet another issue. Dragging them around seems to not be an option for these. I have checked settings under rainmeter and also the skin settings to make sure it wasn't turned off. it isn't disabled anywhere. however I can't move these buttons around which is making things a little difficult for me. now, if I move the text on the button, off to the side of the button, say making the text a X=250 so that it's not sitting on the button at all, then I can click on the text and move the button. otherwise it wont allow me to move it and its a little annoying. here is the code to one of these buttons, the rest are pretty much the same other than text and image used

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1


[MeterLaunch1]
Meter=Button
Y=1
ButtonImage=#@#Images\Blue.png
LeftMouseUpAction=["D:\Shows"]
LeftMouseDownAction=PLAY #@#Sounds\beep2.wav
AntiAlias=1


[Metertext]
Meter=String
Y=5
X=35
StringAlign=Middle
Fontface=Arial bold
FontSize=16
FontColor=10,10,10,255
Antialias=1
Text=Shows
StringEffect=BORDER
FontEffectColor=255,255,255,255
Cellinarac
User avatar
jsmorley
Developer
Posts: 21372
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Creating Buttons

Post by jsmorley »

The point of using Button instead of 3 images and an Image meter is that you DON'T use LeftMouseDownAction. That mouse action will disable dragging of the skin when the cursor is on the button image, as I explained before.

Use ButtonCommand instead of LeftMouseDownAction and LeftMouseUpAction.

https://docs.rainmeter.net/manual/meters/button/#ButtonCommand

[MeterLaunch1]
Meter=Button
Y=1
ButtonImage=#@#Images\Blue.png
ButtonCommand=["D:\Shows"][PLAY "#@#Sounds\beep2.wav"]