It is currently April 19th, 2024, 5:11 pm

Dragging meters inside the skin???

Get help with creating, editing & fixing problems with skins
sssmith
Posts: 3
Joined: March 30th, 2017, 12:15 pm

Dragging meters inside the skin???

Post by sssmith »

Is it possible to drag meters inside the skin? Or at least some workaround, something like measuring cursor position and changing meter position with bangs? Thanks in advance!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dragging meters inside the skin???

Post by jsmorley »

No, there is no practical way to do that. Meters are just not separate objects in the final rendered skin window, and Rainmeter really can't constantly detect the mouse position, or react to a "drag".
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dragging meters inside the skin???

Post by balala »

sssmith wrote:Is it possible to drag meters inside the skin? Or at least some workaround, something like measuring cursor position and changing meter position with bangs? Thanks in advance!
Am I misunderstood something? Because I would say that's possible. Dragging a meter indeed is harder to be done (however maybe even this would be possible), but measuring the position of the cursor when click, then moving a meter to this position, is definitely possible.
For example:

Code: Select all

[Rainmeter]
Update=-1
AccurateText=1
SkinWidth=500
SkinHeight=350
BackgroundMode=2
SolidColor=80,80,80,160
LeftMouseUpAction=[!SetVariable X "$MouseX$"][!SetVariable Y "$MouseY$"][!UpdateMeter "MeterRemaining"][!Redraw]

[Variables]
X=250
Y=175

[MeterRemaining]
Meter=STRING
X=#X#
Y=#Y#
FontColor=220,220,220
FontEffectColor=0,0,0,150
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=Move this
DynamicVariables=1
At the first moment, the "Move this" sting is placed in the center of the skin. When you click, it'll move where you clicked.
sssmith, is this what you wanted?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dragging meters inside the skin???

Post by jsmorley »

That may work for this user, but I would argue that it is quite far from a "drag" operation.

Dragging is not about where your mouse is. It's about "grabbing" an object and dragging it to some other position. The mouse might be anywhere on the object, that is irrelevant. What you really want to capture is the "movement" of the mouse while the mouse button is being held down. That movement is then applied to the X and Y of the object that is selected, in real time.

Anyway, the answer to the question as asked is "you can't'.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dragging meters inside the skin???

Post by balala »

jsmorley wrote:That may work for this user, but I would argue that it is quite far from a "drag" operation.
For sure it's not, but sssmith initially said:
sssmith wrote:measuring cursor position and changing meter position with bangs
That's what could easily be done.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dragging meters inside the skin???

Post by jsmorley »

balala wrote:For sure it's not, but sssmith initially said:

That's what could easily be done.
Fair enough, the answer to a question like "can I change the position of a meter with a mouse click?" is yes. The answer to "can I drag a meter" is no. In a drag operation the position of the mouse is of little or no interest. Only the amount and direction of "movement" of the mouse matters. That movement is then applied to the position of the object, nothing to do with the position of the mouse.

Rainmeter could in theory constantly poll the position of the mouse when the mouse button is held down, and return some X and Y "movement" values, and I think there is even a 3rd-party plugin that could get you close to that. My bigger concern with any kind of "dragging" in Rainmeter is the absolute blizzard of skin redraws that would be needed to get anything even approaching "real time". I can't see a way we could support that which wouldn't be ugly, laggy, and inefficient. The real problem isn't with constantly knowing where the mouse "is", but "what do you do with that information?" in an environment that is based on an Update cycle, not event driven.
sssmith
Posts: 3
Joined: March 30th, 2017, 12:15 pm

Re: Dragging meters inside the skin???

Post by sssmith »

Thanks for replies! I now understand that dragging meters inside a skin is not possible at the moment and a bit difficult to implement... Then maybe it is possible to create parent/child relations between skins? So instead dragging meter I can make it as separate skin, connect it to main skin and then drag it as any other skin, at the same time when I drag main skin child skin will move with it.....?

Changing the position of a meter with a mouse click will work in my case too, but dragging would be perfect.... Thanks again!
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dragging meters inside the skin???

Post by balala »

sssmith wrote:Then maybe it is possible to create parent/child relations between skins? So instead dragging meter I can make it as separate skin, connect it to main skin and then drag it as any other skin, at the same time when I drag main skin child skin will move with it.....?
That's possible, however, if I'm not wrong, maybe it's not very efficient.
Add the following measure to your "main" skin (which will move the "child" skin):

Code: Select all

[MeasureDrag]
Measure=Calc
Formula=( #CURRENTCONFIGX# + #CURRENTCONFIGY# )
OnChangeAction=[!Move "#CURRENTCONFIGX#" "#CURRENTCONFIGY#" "TheOtherConfig"]
DynamicVariables=1
Don't forget to add the appropriate Config name, as last parameter of the !Move bang.
It seems there always will be a delay between the two skins. I'm not sure how this could be avoided, but better I'd say you can't do more than this.