It is currently April 18th, 2024, 12:43 am

## Creating Buttons

Tips and Tricks from the Rainmeter Community
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

### Re: Creating Buttons

Alright, we'll do this the easy way. Each image will need it's own meter.

Code: Select all

``````[Variables]
Img.Num=1

[msNum]
Measure=Calc
Formula=(#Img.Num#+1)>6?1:(#Img.Num#+1)
DynamicVariables=1

[mtButton]
Meter=Button
ButtonImage=Whatever.png
ButtonCommand=!RainmeterSetVariable Img.Num [msNum]
DynamicVariables=1

[msImg1]
Measure=Calc
Formula=#Img.Num#=1?0:1
DynamicVariables=1

[mtImg1]
Meter=Image
ImageName=FirstImage.png
Hidden=[msImg1]
DynamicVariables=1

[msImg2]
Measure=Calc
Formula=#Img.Num#=2?0:1
DynamicVariables=1

[mtImg2]
Meter=Image
ImageName=SecondImage.png
Hidden=[msImg2]
DynamicVariables=1

[msImg3]
Measure=Calc
Formula=#Img.Num#=3?0:1
DynamicVariables=1

[mtImg3]
Meter=Image
ImageName=ThirdImage.png
Hidden=[msIm3]
DynamicVariables=1

and so on...
``````
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Nightglow
Posts: 10
Joined: June 14th, 2010, 6:50 pm

### Re: Creating Buttons

ok so following that setup

Code: Select all

``````[Variables]
Img.Num=1

[msNum]
Measure=Calc
Formula=(#Img.Num#+1)>6?1:(#Img.Num#+1)
DynamicVariables=1

[mtButton]
Meter=Button
X=65
Y=286
ButtonImage=Anchor.png
ButtonCommand=!RainmeterSetVariable Img.Num [msNum]
DynamicVariables=1

[msImg1]
Measure=Calc
Formula=#Img.Num#=1?0:1
DynamicVariables=1

[mtImg1]
Meter=Image
X=195
Y=0
ImageName=Char1.png
Hidden=[msImg1]
DynamicVariables=1

[msImg2]
Measure=Calc
Formula=#Img.Num#=2?0:1
DynamicVariables=1

[mtImg2]
Meter=Image
X=177
Y=0
ImageName=Char2.png
Hidden=[msImg2]
DynamicVariables=1

[msImg3]
Measure=Calc
Formula=#Img.Num#=3?0:1
DynamicVariables=1

[mtImg3]
Meter=Image
X=70
Y=0
ImageName=Char3.png
Hidden=[msIm3]
DynamicVariables=1

[msImg4]
Measure=Calc
Formula=#Img.Num#=4?0:1
DynamicVariables=1

[mtImg4]
Meter=Image
X=194
Y=0
ImageName=Char4.png
Hidden=[msIm4]
DynamicVariables=1

[msImg5]
Measure=Calc
Formula=#Img.Num#=5?0:1
DynamicVariables=1

[mtImg5]
Meter=Image
X=180
Y=0
ImageName=Char5.png
Hidden=[msIm5]
DynamicVariables=1

[msImg6]
Measure=Calc
Formula=#Img.Num#=6?0:1
DynamicVariables=1

[mtImg6]
Meter=Image
X=120
Y=0
ImageName=Char6.png
Hidden=[msIm6]
DynamicVariables=1``````
images 1,3,4,5, and 6 are diplayed. when the button is pressed the 1st image changes and starts cycling through forever behind the displayed 3-6 images that are stuck displayed.
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

### Re: Creating Buttons

Looks like I'm going to have to play with this one. I need to be able to see the measure values in order to troubleshoot. Do you think you could zip up your images and put them on a site like 4shared.com for me to play with?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Nightglow
Posts: 10
Joined: June 14th, 2010, 6:50 pm

### Re: Creating Buttons

smurfier wrote:Looks like I'm going to have to play with this one. I need to be able to see the measure values in order to troubleshoot. Do you think you could zip up your images and put them on a site like 4shared.com for me to play with?
http://www.4shared.com/file/BFiSSKSg/rain_sample.html
I left the current .ini as well, updated a few of the coordinates.
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

### Re: Creating Buttons

Thanks to a small bug in how a couple things work, I had to change things just a little.

Code: Select all

``````[Rainmeter]
Update=500

[Variables]
Img.Num=1

[msImg1]
Measure=Calc
Formula=#Img.Num#=1
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!RainmeterShowMeter mtImg1
IfEqualValue=0
IfEqualAction=!RainmeterHideMeter mtImg1

[mtImg1]
Meter=Image
X=195
Y=0
ImageName=Char1.png
Hidden=1
DynamicVariables=1

[msImg2]
Measure=Calc
Formula=#Img.Num#=2
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!RainmeterShowMeter mtImg2
IfEqualValue=0
IfEqualAction=!RainmeterHideMeter mtImg2

[mtImg2]
Meter=Image
X=200
Y=0
ImageName=Char2.png
Hidden=1
DynamicVariables=1

[msImg3]
Measure=Calc
Formula=#Img.Num#=3
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!RainmeterShowMeter mtImg3
IfEqualValue=0
IfEqualAction=!RainmeterHideMeter mtImg3

[mtImg3]
Meter=Image
X=185
Y=0
ImageName=Char3.png
Hidden=1
DynamicVariables=1

[msImg4]
Measure=Calc
Formula=#Img.Num#=4
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!RainmeterShowMeter mtImg4
IfEqualValue=0
IfEqualAction=!RainmeterHideMeter mtImg4

[mtImg4]
Meter=Image
X=196
Y=0
ImageName=Char4.png
Hidden=1
DynamicVariables=1

[msImg5]
Measure=Calc
Formula=#Img.Num#=5
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!RainmeterShowMeter mtImg5
IfEqualValue=0
IfEqualAction=!RainmeterHideMeter mtImg5

[mtImg5]
Meter=Image
X=205
Y=0
ImageName=Char5.png
Hidden=1
DynamicVariables=1

[msImg6]
Measure=Calc
Formula=#Img.Num#=6
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!RainmeterShowMeter mtImg6
IfEqualValue=0
IfEqualAction=!RainmeterHideMeter mtImg6

[mtImg6]
Meter=Image
X=208
Y=0
ImageName=Char6.png
Hidden=1
DynamicVariables=1

[mtButton]
Meter=Button
X=65
Y=286
ButtonImage=Anchor.png
ButtonCommand=!RainmeterSetVariable Img.Num ((#Img.Num#+1)>6?1:(#Img.Num#+1))
DynamicVariables=1
``````
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Nightglow
Posts: 10
Joined: June 14th, 2010, 6:50 pm

### Re: Creating Buttons

Thank you Smurfier~ That's exactly what I was looking for.

Although when i copied it over to my windows Vista computer the only thing there was the button, and nothing happened if clicked. Why is that? Does Vista require a rainmeter patch of some sort?
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

### Re: Creating Buttons

Are you sure you copied all the images over?
Nightglow
Posts: 10
Joined: June 14th, 2010, 6:50 pm

### Re: Creating Buttons

It already had the images and they were all named correctly, replaced them but didn't change anything.
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

### Re: Creating Buttons

I do not understand as it works perfectly for me and I also run Vista. Are you using the most current version of Rainmeter?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Nightglow
Posts: 10
Joined: June 14th, 2010, 6:50 pm

### Re: Creating Buttons

I think so but ill have to double check it. I'll figure it out at some point but its the spare comp so not a big deal xD Thank you again smurfier~