It is currently December 14th, 2018, 6:41 am

New Mouse Action state bangs

Changes made during the Rainmeter 4.2 beta cycle.
User avatar
jsmorley
Developer
Posts: 18492
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

New Mouse Action state bangs

jsmorley » May 13th, 2018, 2:52 pm

We have added several new bangs, to allow "disabling" or "clearing" and "enabling" or "toggling" mouse actions on meters or the skin background.

The idea of this is that when you need to disable a mouse action for some reason, which can often be the case when you have overlapping meters that both have mouse actions, before you needed to use !SetOption to set the value of the action to either [] (disabled), which would turn off a mouse action without allowing the mouse detection to be passed to any meters or the skin "behind it", or "" (cleared), which would remove the mouse action, allowing any mouse detection to be passed to any meters or the skin "behind it".

The problems this caused were three-fold:

1) The different kinds of mouse actions, for instance "click" actions and "over" actions, did not behave consistently when !SetOption was / is used to set those values.

2) When using [] to disable a mouse action, the cursor would still change to the "hand" when you are over the meter. The action is still "detected", just doesn't do anything. This could be odd-looking at best, and confusing at worst.

3) In order to "re-enable" the mouse action, it had to be re-created from scratch using !SetOption, which could make for a very long and complicated bang indeed, as well as having complexities with """Magic Quotes""" when the mouse action being defined contained embedded quotes itself, which it most likely will.

Now you can just "disable" or "clear" a mouse action from any meter, meter group, skin, or skin group, and when you want it back again, you simply "enable" it, and it returns to its originally defined functionality.

We have designed this for maximum flexibility. You can change the state of any individual mouse action type, some of them or all of them, on a single meter, a group of meters, the current skin background [Rainmeter] or a group of skins.

Please see the documentation at:

Mouse Action state bangs
User avatar
jsmorley
Developer
Posts: 18492
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Mouse Action state bangs

jsmorley » May 13th, 2018, 4:40 pm

Here is a simple example of how you might use this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeterOne]
Meter=Image
W=100
H=100
SolidColor=255,0,0,90
LeftMouseUpAction=[!SetOption MeterOne SolidColor "255,0,0,255"][!UpdateMeter *][!Redraw]

[MeterTwo]
Meter=Image
X=50
Y=50
W=100
H=100
SolidColor=0,255,0,255
MouseOverAction=[!DisableMouseAction MeterOne "LeftMouseUpAction"][!SetOption MeterOne SolidColor "255,0,0,90"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!EnableMouseAction MeterOne "LeftMouseUpAction"]
GIF.gif
Since [MeterTwo] has no LeftMouseUpAction on it, when we are over that, we don't want the "hand" cursor, or any clicks to be passed through and seen by [MeterOne]. So we turn "off" the mouse action on [MeterOne] while we are "over" [MeterTwo], and back "on" when we are not "over".

Note: One thing to be a bit careful of is using * (all) with "disable" just to avoid spelling out the action names in a list. Since * will include RightMouseUpAction, this will in effect disable (block) the skin context menu on the meter or meters defined. Be sure that is what you mean to do...

Using "clear" instead of "disable" won't have this effect, and may be more appropriate in some cases.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeterOne]
Meter=Image
W=100
H=100
SolidColor=255,0,0,90
LeftMouseUpAction=[!SetOption MeterOne SolidColor "255,0,0,255"][!UpdateMeter *][!Redraw]

[MeterTwo]
Meter=Image
X=50
Y=50
W=100
H=100
SolidColor=0,255,0,255
MouseOverAction=[!ClearMouseAction MeterOne "*"][!SetOption MeterOne SolidColor "255,0,0,90"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!EnableMouseAction MeterOne "*"]
Just remember that "disable" is "disable my actions, and block mouse detection on meters behind me", and "clear" is "remove my actions, and allow meters behind me to detect the mouse". They both have uses...
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3052
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: New Mouse Action state bangs

eclectic-tech » May 14th, 2018, 1:46 am

Are there plans for the Button meter's ButtonCommand to have similar options? :confused:
User avatar
Brian
Developer
Posts: 1793
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: New Mouse Action state bangs

Brian » May 14th, 2018, 2:44 am

eclectic-tech wrote:Are there plans for the Button meter's ButtonCommand to have similar options? :confused:
There are no plans at the moment for this. The Button meter handles mouse interacts a little differently than meters.

-Brian
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3052
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: New Mouse Action state bangs

eclectic-tech » May 14th, 2018, 12:51 pm

Thanks Brian!

I don't use Button meters that often, but I thought I would ask.
User avatar
jsmorley
Developer
Posts: 18492
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Mouse Action state bangs

jsmorley » May 14th, 2018, 1:18 pm

eclectic-tech wrote:Thanks Brian!

I don't use Button meters that often, but I thought I would ask.
Button meters have most of the same issues that we found with "disabling" mouse actions on other meters / skin background, but it is a different kind of animal in a lot of ways. For instance, setting the value of ButtonCommand to [] does not "block" the mouse detection from being seen by meters behind it, like it does on other mouse actions. I mean it might, but only if what is "behind" it is also a Button meter, and what are the chances of that?

While it might be tempting to just use LeftMouseUpAction on the Button meter instead of ButtonCommand, there are some important differences in how mouse detection is done on the "solid bits" of a Button meter with ButtonCommand vs. LeftMouseUpAction.

I think to attack this, a simple "option" on the meter might be the best and simplest way to go. Something like ButtonCommandActive=0/1 with 1 the default. Since there is only one kind of "action" and it doesn't involve the skin background, then using !SetOption or !SetOptionGroup to change the value of ButtonCommandActive should do the trick.

However, there are some logic / cosmetic issues that would need to be considered. If a Button command is "disabled", do you still want the button "states" to be active, or does that just make the button a static "image"? What is the point of a button that is changing states when you hover it, or click down on it, but then it doesn't do anything when you release the mouse? That feels confusing at best, not worst...

If I wanted to "toggle" the state of a Button meter, I would personally be tempted to have both the Button meter and a static Image meter, and use !SetOption to toggle the hide / show state of each.

I'm not sure this is a good fit for this, but we can keep it on the radar for the future.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3052
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: New Mouse Action state bangs

eclectic-tech » May 14th, 2018, 2:09 pm

Yeah, the button meter mouse interaction is quite a bit different... those ideas are probably the best alternative because of the uniqueness of the button meter. Thanks as always! :thumbup:
User avatar
kyriakos876
Posts: 886
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: New Mouse Action state bangs

kyriakos876 » May 15th, 2018, 4:06 pm

While you're on it, you might as well check a thing I've noticed that occurs when I "MouseLeave" very quickly the action won't register and I have to MouseOver and MouseLeave again for it to register. (It doesn't happen always but I'm thinking something like, check if the mouse is over the skin like you do now, but once again after some time, like, 16ms or something. This might be stupid thought but yea... I drop the ideas out there, you never know.)