Page 1 of 2

Increase bar clicking on button image?

Posted: May 23rd, 2018, 7:13 am
by GioRgSaVv
Hello, I just want to know if it's possible to increase/decrease the bar from a skin by clicking on a button skin.

This for example:
Image

Something like "MouseUpAction=BarSkin +5%" ?? or something similar?

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 11:22 am
by balala
GioRgSaVv wrote:I just want to know if it's possible to increase/decrease the bar from a skin by clicking on a button skin.
It is. For example:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
BarWidth=200

[MeasureRandom]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=0
HighBound=100
MinValue=0
MaxValue=100

[MeterDecreaseWidth]
Meter=STRING
X=40
Y=10
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=-
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "50,50,50"][!SetOption #CURRENTSECTION# SolidColor "220,220,220,150"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "220,220,220"][!SetOption #CURRENTSECTION# SolidColor "0,0,0,150"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!SetVariable BarWidth "(#BarWidth#-10)"][!UpdateMeter "MeterBar"][!UpdateMeterGroup "Buttons"][!Redraw]
DynamicVariables=1
Group=Buttons

[MeterIncreaseWidth]
Meter=STRING
X=5R
Y=0r
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=+
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "50,50,50"][!SetOption #CURRENTSECTION# SolidColor "220,220,220,150"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "220,220,220"][!SetOption #CURRENTSECTION# SolidColor "0,0,0,150"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!SetVariable BarWidth "(#BarWidth#+10)"][!UpdateMeter "MeterBar"][!UpdateMeterGroup "Buttons"][!Redraw]
DynamicVariables=1
Group=Buttons

[MeterBar]
MeasureName=MeasureRandom
Meter=BAR
X=0R
Y=-10r
W=#BarWidth#
H=20
BarColor=255,240,0
SolidColor=80,80,80,150
BarOrientation=Horizontal
DynamicVariables=1

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 12:04 pm
by GioRgSaVv
No no no, not this :D
:17denial


Sorry, I wasn't clear enough, what I was trying to say is to fill the bar by clicking a button.
But thanks a lot for the code! I will save that for later, maybe it will be useful in the future :)

I actually made it tho.
Image

It is now complete, but I have only one little problem... is it possible not to refresh a skin even after when I click the "refresh all" button from rainmeter application?
I want to keep on tracking how many times I do something, like daily goals, but if I refresh all skins this will also refresh, obviously, so it will reset.

I bet I will need to use some scripts program in order to achieve that, right? :/

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 1:26 pm
by jsmorley
You just need to use !WriteKeyValue in order to make the value you set "persistent" by writing it to the skin file.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Current=27

[CurrentValue]
Measure=Calc
Formula=#Current#
DynamicVariables=1
MinValue=0
MaxValue=100

[MeterCurrent]
Meter=Bar
MeasureName=CurrentValue
W=300
H=20
BarOrientation=Horizontal
BarColor=0,255,0,255
SolidColor=47,47,47,255

[MeterIncrease]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Increase
DynamicVariables=1
LeftMouseUpAction=[!SetVariable Current "(#Current#+1)"][!WriteKeyValue Variables Current "(#Current#+1)"][!UpdateMeter *][!Redraw]

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 1:29 pm
by eclectic-tech
GioRgSaVv wrote:No no no, not this :D
:17denial


Sorry, I wasn't clear enough, what I was trying to say is to fill the bar by clicking a button.
But thanks a lot for the code! I will save that for later, maybe it will be useful in the future :)

I actually made it tho.
Image

It is now complete, but I have only one little problem... is it possible not to refresh a skin even after when I click the "refresh all" button from rainmeter application?
I want to keep on tracking how many times I do something, like daily goals, but if I refresh all skins this will also refresh, obviously, so it will reset.

I bet I will need to use some scripts program in order to achieve that, right? :/
What you need to do when you set the new value of the bars on a click, is to also use !WriteKeyValue to permanently write that value to the [Variables] section.

Without seeing your code, I can only show you a generic example. This would be used on the button meters...

Code: Select all

[PlusButton]
...
LeftmouseUpAction=[!SetVariable NumberOfBars (Clamp(#NumberOfBars#+1,0,5))][!WriteKeyValue Variables NumberOfBars (Clamp(#NumberOfBars#+1,0,5))][!UpdateMeter *][!Redraw]

[MinusButton]
...
LeftmouseUpAction=[!SetVariable NumberOfBars (Clamp(#NumberOfBars#-1,0,5))][!WriteKeyValue Variables NumberOfBars (Clamp(#NumberOfBars#-1,0,5))][!UpdateMeter *][!Redraw]

EDIT: JSMorley beat me again, but I would consider using the Clamp function so you stay within the range of possible bars. :sly:

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 1:35 pm
by jsmorley
eclectic-tech wrote: EDIT: JSMorley beat me again, but I would consider using the Clamp function so you stay within the range of possible bars. :sly:
Yes, my example was the most generic of generic examples. I would also suggest that you need some kind of "reset" button on this. Having to hit minus repeatedly in order to start over didn't test well with the focus group in the Rainmeter Usability Lab.

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 1:38 pm
by eclectic-tech
jsmorley wrote:Yes, my example was the most generic of generic examples. I would also suggest that you need some kind of "reset" button on this. Having to hit minus repeatedly in order to start over didn't test well with the focus group in the Usability Lab.
Yes, using this scheme, a third button would be needed to reset... :17nodding

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 8:40 pm
by GioRgSaVv
Ah it's actually a lot harder than I thought :/
In the end I just made it with... images and not as a bar meter :o

I upload it.
I just added tons of images and I completed it with a different way :/

I want to use your way in order to complete it, but I just can't make it work with the spaces, how to separate the same bar to small pieces? In my case 5 pieces, and each click on the button image will fill the bar by 1 piece, 1 box.

By the way thanks a lot for your time and your help! I appreciate it! :)

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 8:46 pm
by balala
GioRgSaVv wrote:Ah it's actually a lot harder than I thought :/
In the end I just made it with... images and not as a bar meter :o
Image and Bar meters are for completely different things. But why do you find it so hard? I think it isn't. jsmorley gave you a sample code.

Re: Increase bar clicking on button image?

Posted: May 23rd, 2018, 9:02 pm
by GioRgSaVv
By the way I just found out that when I click again the "increase" button while bar is already at max it will keep "counting" but won't show it.
Each click will increase the bar by 20% so it will go 120-140-160% but it will only show the normal length of the bar, so I will need to press the decrease button 3 more times for 140-120-and 100 :P even tho minvalue is 0 and maxvalue is 100 (yes it goes bellow 0 too! :P )