It is currently March 28th, 2024, 5:39 pm

[Bug] Shape as Container, meters inside are visible but not clickable

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
khanhas
Posts: 40
Joined: October 26th, 2016, 5:00 pm

[Bug] Shape as Container, meters inside are visible but not clickable

Post by khanhas »

Example skin:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[S]
Meter=String
Text = CLICK
FontSize = 30
SolidColor = FF0000
LeftMOuseUpAction = [!SetOption S Text "CLICKED"][!Update]
Container = Container
X = 0

[S2]
Meter=String
Text = ME
FontSize = 30
SolidColor = 0000FF
LeftMOuseUpAction = [!SetOption S2 Text "MEED"][!Update]
X = 200
Container = Container

[Container]
Meter = Shape
W = 300
H = 200
SolidColor= 0,0,0
It worked normally in 4.3-3271 beta.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Bug] Shape as Container, meters inside are visible but not clickable

Post by jsmorley »

Short answer:

There is no such thing as a default shape. You have to define the shape as something, Rectangle, Ellipse, Path, whatever.

If you change that meter to Meter=Image, then it works fine.

[Container]
Meter=Image
W=300
H=200
SolidColor=0,0,0

Or if you properly define the shape, then it works fine.

[Container]
Meter=Shape
Shape=Rectangle 0,0,300,200 | StrokeWidth 0
;W=300
;H=200
;SolidColor=0,0,0

You don't need the W / H / SolidColor on that. It does no harm, but it's redundant and pointless.

Long answer:

The reason that this appeared to work for you in an earlier beta was due to some "broken" mouse detection in earlier betas. It's almost too complicated to get into, but the long and the short of it is that your example is not "supposed" to work, and properly "doesn't". A Shape meter with no "shape" is invalid. It has no solid content in it that can detect the mouse. Mouse detection in Shape meters isn't like other meters. It's not based on the meter rectangle created by W / H / SolidColor, but on the solid pixels of the Shape(s) created by the meter. Your example doesn't create any.

https://docs.rainmeter.net/manual/meters/shape/#MouseDetection

Mouse detection in a "content / container" relationship is based on both the content meter and the container meter. It must be detected in both.

Yes, it is a bit weird that the "content" meters display at all, in a sense they are being "fooled" by the W / H / SolidColor on the meter. In a perfect world they probably shouldn't even display in a Shape meter with no "shape". However, I'm not interested into digging into that, as I really don't care. A Shape meter with no "shape" is invalid, won't ever detect the mouse, and is of no value.

If you want to create a simple rectangular meter to act as a "container", either use Meter=Image / W / H / SolidColor, which is designed to actually create a real "image" based on those dimensions and color, or use a simple Shape meter with a properly defined Shape=Rectangle X,Y,W,H. I'm not sure there is any particular advantage to either choice in that case. I would probably use the Shape meter as I really like how Shape meters work, (and it's one option instead of three) but functionally it is six of one and a half-dozen of the other.

Yes, other meter types can be forced to play this role with W / H / SolidColor, as most (but not all) meter types will detect the mouse on any solid pixel in the meter, and as long as they don't actually spit out errors in the log if they have no functional value, they will create a "container" based on the W and H that can be used, but just DON'T. Use Meter=Image or a proper Meter=Shape for this.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Bug] Shape as Container, meters inside are visible but not clickable

Post by balala »

jsmorley wrote: March 31st, 2019, 11:19 am There is no such thing as a default shape. You have to define the shape as something, Rectangle, Ellipse, Path, whatever.
:o Very good! Have no comments. Looking at khanhas's post couldn't realize there is a such simple explanation. But there indeed is.
Post Reply