It is currently April 24th, 2024, 5:26 am

LeftMouseUpAction consecutively

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 866
Joined: January 4th, 2018, 9:52 pm

LeftMouseUpAction consecutively

Post by xenium »

Hi,
I have 2 buttons and 4 images.
I would like that when I click consecutively on the first button, each image will appear one after the other,and when I click consecutively on the second button, each image disappears one after the other.
Like this example:
GIF.gif
How can I do this ?

Thank you
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction consecutively

Post by balala »

xenium wrote: June 16th, 2019, 2:59 pm I would like that when I click consecutively on the first button, each image will appear one after the other,and when I click consecutively on the second button, each image disappears one after the other.
Add a variable to the [Variables] section. For example you can name it Image:

Code: Select all

[Variables]
Image=0
Then add the following LeftMouseUpAction tp the two buttons:

Code: Select all

[Button1]
...
LeftMouseUpAction=[!SetVariable Image "(Clamp((#Image#+1),0,3))"][!UpdateMeasure "MeasureImage"][!UpdateMeter "Button1"][!UpdateMeter "Button2"]

[Button2]
...
LeftMouseUpAction=[!SetVariable Image "(Clamp((#Image#-1),0,3))"][!UpdateMeasure "MeasureImage"][!UpdateMeter "Button1"][!UpdateMeter "Button2"]
Finally add the following measure (already updated above):

Code: Select all

[MeasureImage]
Measure=Calc
Formula=#Image#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeter "MeterImage1"] [!HideMeter "MeterImage2"][!HideMeter "MeterImage3"][!HideMeter "MeterImage4"][!Redraw]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!ShowMeter "MeterImage1"] [!ShowMeter "MeterImage2"][!HideMeter "MeterImage3"][!HideMeter "MeterImage4"][!Redraw]
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=[!ShowMeter "MeterImage1"] [!ShowMeter "MeterImage2"][!ShowMeter "MeterImage3"][!HideMeter "MeterImage4"][!Redraw]
IfCondition4=(#CURRENTSECTION#=3)
IfTrueAction4=[!ShowMeter "MeterImage1"] [!ShowMeter "MeterImage2"][!ShowMeter "MeterImage3"][!ShowMeter "MeterImage4"][!Redraw]
DynamicVariables=1
Obviously you have to use here the appropriate names for the Image meters.
The value of the Image variable is controlling which meters are visible and which ones are hidden.
User avatar
xenium
Posts: 866
Joined: January 4th, 2018, 9:52 pm

Re: LeftMouseUpAction consecutively

Post by xenium »

balala wrote: June 16th, 2019, 3:45 pm
Thank you very much ! :bow:
We also added DynamicVariables = 1 to each button
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: LeftMouseUpAction consecutively

Post by StArL0rd84 »

Can be done without the measure.
I usually shy away from !SetOption if i can get away with it.
And one less measure is CPU recourse saved.

Add this to the meter and use the Image variable directly.

Y=(#Image# = 1 ? 10 : -1000)
DynamicVariables=1

It gets a little hard if you want to assign colors without !SetOption.
But if you don't need that, the formula in the meter should be sufficient.

https://docs.rainmeter.net/manual/formulas/
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction consecutively

Post by balala »

xenium wrote: June 16th, 2019, 4:43 pm We also added DynamicVariables = 1 to each button
Yep, right. It has to be added. Sorry I missed it.