It is currently October 25th, 2021, 6:27 am

Mouse up action after dragging - drag release action

Help with creating, editing & fixing problems with skins
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Mouse up action after dragging - drag release action

Post by Edhel »

Hello, I have returned to playing with Rainmeter after a long time and my skill are a bit rusty.
In short, I am trying to align a skin to a custom grid after dragging. The aligning part is simple and it works well on LeftMouseUpAction. However, when I drag the skin and then release the button, the LeftMouseUpAction doesn't trigger. Is there any way how to enforce the mouse up action after dragging? (So I could drag the skin to an approximate location and let it align to the closest grid cell.)
I did go through some older posts here with no solution. I am also aware there is mouse plugin but it doesn't have "drag release" action, only "dragging" action.
User avatar
1690Cat
Posts: 21
Joined: September 27th, 2012, 3:02 pm

Re: Mouse up action after dragging - drag release action

Post by 1690Cat »

If you are using the mouse plugin then
LeftMouseUpAction=[!CommandMeasure MeasureMouse "Stop"]
should do it.
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: Mouse up action after dragging - drag release action

Post by Edhel »

I did try the Mouse plugin and I must be doing something wrong... :?
I have
LeftMouseUpAction=[!CommandMeasure MeasureMouse "Stop"][!UpdateMeasure "MeasureX"][!UpdateMeasure "MeasureY"][!UpdateMeasure "Mover"]
on the MeasureMouse measure with the plugin.
MeasureX and MeasureY calculate the proper position in the grid and save the values in variables (OnUpdateAction).
Measure Mover moves the skin to coordinates given in the variables (OnUpdateAction).
I am watching the variables and measures values in the log and I see them change immediately when I release the left button. However, the skin doesn't move until I just click on it without dragging. (I did check the posision on screen in picture editor and the "right" coordinates are those after the move.)
I did try to update the measures gradually - Left mouse up updates MeasureX => MeasureX updates MeasureY => MeasureY updates Mover.
I did try skip the MeasureX and MeasureY and set the variables directly in LeftMouseUpAction and I also did try to move the skin directly in LeftMouseUpAction.
Occasionally, there is a blip when the skin appears on the right position right after the button release for a split of a second and then jumps back to where I dropped it.
User avatar
1690Cat
Posts: 21
Joined: September 27th, 2012, 3:02 pm

Re: Mouse up action after dragging - drag release action

Post by 1690Cat »

You need to use
LeftMouseDownAction=[!CommandMeasure MeasureMouse "Start"]
to start the action not LeftMouseUpAction
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: Mouse up action after dragging - drag release action

Post by Edhel »

Maybe we don't understand each other...
I don't need to start that action. I need to perform the action (calculate the position and move the skin) when I release the button after dragging. That should be the LeftMouseUpAction. What I don't get is why part of the bangs get's executed and the other doesn't.
I did try to add the LeftMouseDownAction=[!CommandMeasure MeasureMouse "Start"] to the MouseMeasure and it had no effect.
I did also start logging the values of MeasureX and MeasureY in the LeftMouseUpAction and in Mover measure on the update and there is a log record from the Mover measure when I release the button but the skin doesn't move. :???:
User avatar
death.crafter
Posts: 1065
Joined: April 24th, 2021, 8:13 pm

Re: Mouse up action after dragging - drag release action

Post by death.crafter »

Code: Select all

[MeasureMouse]
Measure=Plugin
Plugin=Mouse
LeftMouseDragAction=your action
LeftMouseUpAction=[!CommandMeasure MeasureMouse Stop]<your other actions>

[MeterDragger]
Meter=Image
H=20
W=20
LeftMouseDownAction=[!CommandMeasure MeasureMouse Start]
from the Realm of Death
My Current Desktop
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: Mouse up action after dragging - drag release action

Post by Edhel »

death.crafter: Thank you for spending your time on me. However, that is not what I am trying to achieve. I don't want to drag a meter within a skin or trace it. I want to reposition the skin after moving it. To better understand what is going on, see my log:
NOTE (20:17:01.994) Tester\Test\Draggrid.ini: Old coordinates 560 560 - Draggin starts
NOTE (20:17:03.623) Tester\Test\Draggrid.ini: New coordinates 880 320 - Dragging ends
NOTE (20:17:03.627) Tester\Test\Draggrid.ini: I moved to 880 320 - ... except I didn't!
NOTE (20:17:06.515) Tester\Test\Draggrid.ini: Old coordinates 880 320 - Click mouse down
NOTE (20:17:06.578) Tester\Test\Draggrid.ini: New coordinates 880 320 - Click mouse up
NOTE (20:17:06.583) Tester\Test\Draggrid.ini: I moved to 880 320 - ... and now I did move!
User avatar
death.crafter
Posts: 1065
Joined: April 24th, 2021, 8:13 pm

Re: Mouse up action after dragging - drag release action

Post by death.crafter »

Edhel wrote: September 14th, 2021, 6:30 pm death.crafter: Thank you for spending your time on me. However, that is not what I am trying to achieve. I don't want to drag a meter within a skin or trace it. I want to reposition the skin after moving it. To better understand what is going on, see my log:
I don't follow tho. Why are you using Mouse to move a skin when you could just simply drag it.

If you want to know the current coordinates then just use [#CURRENTCONFIGX] [#CURRENTCONFIGY].

You will need dynamic variables where they are used.
from the Realm of Death
My Current Desktop
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: Mouse up action after dragging - drag release action

Post by Edhel »

death.crafter wrote: September 15th, 2021, 3:41 am I don't follow tho. Why are you using Mouse to move a skin when you could just simply drag it.

If you want to know the current coordinates then just use [#CURRENTCONFIGX] [#CURRENTCONFIGY].

You will need dynamic variables where they are used.
It would help to read the original post. I am trying to align skin into a custom grid. The main issue is that releasing the mouse button after dragging the skin is not recognized as LeftMouseUpAction. 1960Cat suggested to use the Mouse plugin. It partially works, releasing the button triggers events and calculates the correct position for the skin in the drig but it does not move the skin. Just clicking the skin moves it.
User avatar
death.crafter
Posts: 1065
Joined: April 24th, 2021, 8:13 pm

Re: Mouse up action after dragging - drag release action

Post by death.crafter »

Edhel wrote: September 15th, 2021, 4:33 pm It would help to read the original post. I am trying to align skin into a custom grid. The main issue is that releasing the mouse button after dragging the skin is not recognized as LeftMouseUpAction. 1960Cat suggested to use the Mouse plugin. It partially works, releasing the button triggers events and calculates the correct position for the skin in the drig but it does not move the skin. Just clicking the skin moves it.
Ohh, then use move bang to move the skin.

And leftmouseupaction should be used in the measure and not the meter.

But still, I would just make a measure that calculates the position of a grid according to current skin x and y, then make a measure for moving the skin to that position. If you know lua then the job would be far lot easier.

Currently I can't provide an example of what I am saying because I broke my pc and I don't know when will it be back but once it's back I will provide an example.
from the Realm of Death
My Current Desktop