It is currently March 29th, 2024, 6:42 am

Multiple Roundline as buttons and Mouse actions problem

Get help with creating, editing & fixing problems with skins
Unatomic
Posts: 33
Joined: October 23rd, 2012, 7:37 pm

Multiple Roundline as buttons and Mouse actions problem

Post by Unatomic »

normal.png
Basic idea is to create a wheel to change sound output devices. There is a circle. When mouse hover, then show the buttons. (these buttons change the sound output index)
explain.png
The problem is that no matter which button I press, the output index is always "6".
How can the separate "buttons" be identified and used?

Am I wrong somewhere in the code? Is it a bug? Am i stupid (most common answer in my problems :D )?
(Notice the comments in the code and delete what not needed)

Code: Select all

[Rainmeter]
Update=1000
@Includeglobals=#@#global_variables.inc
MouseScrollDownAction=[!CommandMeasure "MeasureWin7Audio" "ChangeVolume -5"][!Update]
MouseScrollUpAction=[!CommandMeasure "MeasureWin7Audio" "ChangeVolume +5"][!Update]

[StringStyle]
FontColor=#GlobalTextColor#
FontFace=#GlobalFont#
FontSize=25
StringEffect=NONE
StringStyle=bold
StringAlign=LEFT
AntiAlias=1
Solid=1

[MeasureWin7Audio]
Measure=Plugin
Plugin=Plugins\Win7AudioPlugin.dll

[PercentageCalc]
Measure=Calc
Formula=(MeasureWin7Audio+1-1)

[VolumeCalc]
Measure=Calc
Formula=MeasureWin7Audio/100

;===============================



;ignore these next 3 meters for the sake of the test. maybe delete them
[MeterTextvolume]
Meter=String
MeterStyle=StringStyle
MeasureName=PercentageCalc
StringAlign=center
X=125
Y=103
Text="%1"

[volumeRing]
Meter=ROUNDLINE
X=0
Y=0
H=250
W=250
LineLength=60
LineStart=40
StartAngle=-4.712
RotationAngle=6.283
AntiAlias=1
LineColor=#GlobalBackgroundColor#
Solid=1

[volumeMeter]
Meter=ROUNDLINE
MeasureName=VolumeCalc
X=0
Y=0
H=250
W=250
LineLength=60
LineStart=40
StartAngle=-4.712
AntiAlias=1
LineColor=#GlobalSkinColor#
Solid=1
;ignore ends





;when mouse hovers over this circle,
;the 6 options become available
[MenuRing]
Meter=ROUNDLINE
Group=Ring
X=0
Y=0
H=250
W=250
LineLength=105
LineStart=60
StartAngle=0
RotationAngle=100
AntiAlias=1
LineColor=255, 255,255, 5
Solid=1
MouseOverAction=[!ShowMeterGroup SoundDevice][!Redraw]
MouseLeaveAction=[!HideMeterGroup SoundDevice][!Redraw]





;these meters need to be clicked and change the output index acordingly
[SoundDevice1]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(240*(PI/180))
RotationAngle=(60*(PI/180))
AntiAlias=1
LineColor=255, 255,255, 30
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 1"][!HideMeterGroup SoundDevice][!Redraw]

[SoundDevice2]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(300*(PI/180))
RotationAngle=(60*(PI/180))
AntiAlias=1
LineColor=255, 255,255, 20
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 2"][!HideMeterGroup SoundDevice][!Redraw]

[SoundDevice3]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(0*(PI/180))
RotationAngle=(60*(PI/180))
AntiAlias=1
LineColor=255, 255,255, 30
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 3"][!HideMeterGroup SoundDevice][!Redraw]

[SoundDevice4]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(60*(PI/180))
RotationAngle=(60*(PI/180))
AntiAlias=1
LineColor=255, 255,255, 20
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 4"][!HideMeterGroup SoundDevice][!Redraw]

[SoundDevice5]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(120*(PI/180))
RotationAngle=(60*(PI/180))
AntiAlias=1
LineColor=255, 255,255, 30
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 5"][!HideMeterGroup SoundDevice][!Redraw]

[SoundDevice6]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(180*(PI/180))
RotationAngle=(60*(PI/180))
AntiAlias=1
LineColor=255, 255,255, 20
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 6"][!HideMeterGroup SoundDevice][!Redraw]
You do not have the required permissions to view the files attached to this post.
Unatomic
Posts: 33
Joined: October 23rd, 2012, 7:37 pm

Re: Multiple Roundline as buttons and Mouse actions problem

Post by Unatomic »

Simpler code for tests purposes.

When hovering the mouse over the meter, 3 roundline buttons appear.

First button is pressed but the third is registered.
Second button is pressed but the third is registered.
Third button is pressed and this time the third is registered.

Anyone could help?

Code: Select all

[Rainmeter]
Update=1000

[MeasureWin7Audio]
Measure=Plugin
Plugin=Plugins\Win7AudioPlugin.dll



;when mouse hovers over this circle,
;the 3 following options become unhiden and available
[MenuRing]
Meter=ROUNDLINE
Group=Ring
X=0
Y=0
H=250
W=250
LineLength=105
LineStart=60
StartAngle=0
RotationAngle=100
AntiAlias=1
LineColor=255, 255,255, 5
Solid=1
MouseOverAction=[!ShowMeterGroup SoundDevice][!Redraw]
MouseLeaveAction=[!HideMeterGroup SoundDevice][!Redraw]





;these meters need to be clicked and change the output index acordingly
[SoundDevice1]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(240*(PI/180))
RotationAngle=(120*(PI/180))
AntiAlias=1
LineColor=255, 0,0, 30
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 1"][!HideMeterGroup SoundDevice][!Redraw]



[SoundDevice2]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(0*(PI/180))
RotationAngle=(120*(PI/180))
AntiAlias=1
LineColor=0, 255,0, 30
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 2"][!HideMeterGroup SoundDevice][!Redraw]



;no matter if the first or the second button above are pressed,
;it is like this button is clicked.
[SoundDevice3]
Meter=ROUNDLINE
Group=SoundDevice
X=0
Y=0
H=250
W=250
LineLength=100
LineStart=60
StartAngle=(120*(PI/180))
RotationAngle=(120*(PI/180))
AntiAlias=1
LineColor=0, 0,255, 30
Solid=1
Hidden=1
leftmouseupaction=[!CommandMeasure "MeasureWin7Audio" "SetOutPutIndex 3"][!HideMeterGroup SoundDevice][!Redraw]
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Multiple Roundline as buttons and Mouse actions problem

Post by ikarus1969 »

As far as i know mouse-actions are always registered within the bounding-box of the roundline-meter.
As all 3 "buttons" have the same bounding-box, only the last one (the third) registers mouse-actions.

That is the difference to Shapes, which register actions only on non-transparent areas of the shape.

Try to substitute the "butttons" with different shape-meters - i think that will work
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Multiple Roundline as buttons and Mouse actions problem

Post by jsmorley »

Yes, the problem is that all three Roundline meters are at the same position, and are the same size. So they are in effect just all overlaying each other, and the "last" or in a sense "top" one defined in the skin will be the one that reacts to the mouse.

The problem isn't no much that the mouse is triggered on any part of a RoundLine meter, that's not so. It is triggered on any "solid pixel" within the bounding box of the Roundline meter. The trouble here is that all the pixels in the Roundline meter(s) are solid, as first, the background Roundline meter is entirely solid when you mouse over it, and second, even if you removed that, each of the Roundline meters, when laid on top of each other result in all pixels in the meter(s) being solid. The mouse only asks "is this pixel solid, and is it within the bounding box this meter?". It does NOT ask "who made this pixel solid?".

The difference between the Shape meter and almost all other meters is that the Shape meter in fact IS designed to ask "did I make this pixel solid?", and in fact doesn't ask the question "is it within the bounding box of this meter?". Only the Button and Shape meters make this distinction, and we can't now change the others without significant backwards compatibility issues.

I tend to agree that using Shape meters for this might be the most effective, in order to get the mouse targets exactly on, and exactly shaped the same as, the elements you draw.

Not going to be trivial to do however. To get it exactly right will take some carefully designed shapes using Path's with Arc's or Bézier Curve's. An alternative would be to create some simple rectangular shapes that you position and rotate to get them more or less on the various Roundline elements, and put the mouse action(s) on them. Just be sure they don't overlap. This wouldn't be as exact, but probably significantly easier.

Another option, also not trivial, is to in fact use Button meters for this. That would entail creating the elements in some external program like PhotoShop or Gimp, and saving each of them as a proper 3-frame "bitmap" image for each of the separate elements. Once those are used as Button meters in the skin, the fact that they overlap won't be an issue.

https://docs.rainmeter.net/tips/button-images/
Unatomic
Posts: 33
Joined: October 23rd, 2012, 7:37 pm

Re: Multiple Roundline as buttons and Mouse actions problem

Post by Unatomic »

I had this problem for years, wondering why is nothing registered correctly. Now the reason of this happening is clear. Thank you for your time. :thumbup:

Well... that is unfortunate tho... XD Photoshop buttons do not appear that well and the shape meters are so frustrating to create. :(

A button having "Roundline" properties would be great but I think I will just settle with a hexagon shaped skin for now. :D
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Multiple Roundline as buttons and Mouse actions problem

Post by Mor3bane »

you do not need a 'visible' item to click.
The roundlines can have the property for SolidColor=0,0,0,1
And obviously the roundlines would all be separate meters, placed so they appear once the mouse is registered on the main roundine as per your preferences.
The bounding box of the roundline will technically be a square as are all such objects - even images of a circle with transparency outside the circle image. In this view, why not use images of circles that are scaled to be only the size of the needed button scale?
I think you are overcomplicating this. I have done several projects similar to yours using static images - where in reality you can use any viable manner to generate your buttons e.g. roundline / png / button / or even a simulated animate gif (tricky but not impossible)
The catch here is with each version of button you may decide to use will require a lot of hidden code that is made to handle whatever choice you decide on.
Clever 'Group' parameters is your key, and calling them with mouse hover or click (it doesnt matter just to get them to appear and remain can all be done with the Group parameter).
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Multiple Roundline as buttons and Mouse actions problem

Post by Mor3bane »

Have a look at this:
https://www.deviantart.com/dwya/art/Arcane-Interface-beta-750132867

It uses a lot of grouping and has several configurations from a base skin.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.