It is currently April 20th, 2024, 4:01 pm

LeftMouseUpAction Question

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

LeftMouseUpAction Question

Post by xenium »

How can I do this?

LeftMouseUpAction = [! ShowMeter "image1"] [! HideMeter "image2"]
LeftMouseUpAction again = [! ShowMeter "image2"] [! HideMeter "image1"]

Thanks
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: LeftMouseUpAction Question

Post by kyriakos876 »

xenium wrote:How can I do this?

LeftMouseUpAction = [! ShowMeter "image1"] [! HideMeter "image2"]
LeftMouseUpAction again = [! ShowMeter "image2"] [! HideMeter "image1"]

Thanks
One way can be:

Code: Select all

LeftMouseUpAction = [!ToggleMeter "image1"] [!ToggleMeter "image2"]
And put Hidden=0 on image1 and Hidden=1 on image2.

But if something changes the hidden state, you might have some issue. So place your Hide.show carefully in other places of the code.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: LeftMouseUpAction Question

Post by ikarus1969 »

xenium wrote:How can I do this?

LeftMouseUpAction = [! ShowMeter "image1"] [! HideMeter "image2"]
LeftMouseUpAction again = [! ShowMeter "image2"] [! HideMeter "image1"]

Thanks
You can use the !ToggleMeter bang, so:

Code: Select all

LeftMouseUpAction=[!ToggleMeter "image1"][!ToggleMeter "image2"]
Docu: https://docs.rainmeter.net/manual-beta/bangs/#ShowHideToggleMeter
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: LeftMouseUpAction Question

Post by xenium »

Thanks for the help !
User avatar
balala
Rainmeter Sage
Posts: 16150
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction Question

Post by balala »

For sure kyriakos876's and ikarus1969's replies are good enough and toggling the images is a solution, but as usual, there are others, too. Here is my approach:
Add a variable (let's name it ImageVis) to the [Variables] section of your skin:

Code: Select all

[Variables]
ImageVis=0
The value of this variable determines which image is visible at a given moment, through the following Calc measure. Add it:

Code: Select all

[MeasureVisibility]
Measure=Calc
Formula=#ImageVis#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeter "image1"][!HideMeter "image2"]
IfFalseAction=[!ShowMeter "image2"][!HideMeter "image1"]
DynamicVariables=1
With this approach you can toggle the images setting the value of the ImageVis variable. Replace the LeftMouseUpAction option of the meter with this: LeftMouseUpAction=[!SetVariable ImageVis "(1-#ImageVis#)"][!UpdateMeasure "MeasureVisibility"].
You have to do one more thing: add a DynamicVariables=1 option to the meter which has the above LeftMouseUpAction (unless not already added). This is important, because if you don't add this option, one single toggle will be made.
Maybe this approach sound a bit more complicated than that posted before, but it has an advantage: if needed, the toggle can be made, beside the meter, from other meters / measures, too.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: LeftMouseUpAction Question

Post by xenium »

balala wrote:For sure kyriakos876's and ikarus1969's replies are good enough and toggling the images is a solution, but as usual, there are others, too. Here is my approach:
Add a variable (let's name it ImageVis) to the [Variables] section of your skin:

Code: Select all

[Variables]
ImageVis=0
The value of this variable determines which image is visible at a given moment, through the following Calc measure. Add it:

Code: Select all

[MeasureVisibility]
Measure=Calc
Formula=#ImageVis#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeter "image1"][!HideMeter "image2"]
IfFalseAction=[!ShowMeter "image2"][!HideMeter "image1"]
DynamicVariables=1
With this approach you can toggle the images setting the value of the ImageVis variable. Replace the LeftMouseUpAction option of the meter with this: LeftMouseUpAction=[!SetVariable ImageVis "(1-#ImageVis#)"][!UpdateMeasure "MeasureVisibility"].
You have to do one more thing: add a DynamicVariables=1 option to the meter which has the above LeftMouseUpAction (unless not already added). This is important, because if you don't add this option, one single toggle will be made.
Maybe this approach sound a bit more complicated than that posted before, but it has an advantage: if needed, the toggle can be made, beside the meter, from other meters / measures, too.
:thumbup:
Thank you for your solution!
User avatar
balala
Rainmeter Sage
Posts: 16150
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction Question

Post by balala »

Did it work?
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: LeftMouseUpAction Question

Post by xenium »

balala wrote:Did it work?
Yes, it works !
User avatar
balala
Rainmeter Sage
Posts: 16150
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LeftMouseUpAction Question

Post by balala »

xenium wrote:Yes, it works !
:thumbup: Ok, I'm glad. :thumbup: