It is currently February 23rd, 2024, 3:43 am

Delaying an Action

Report bugs with the Rainmeter application and suggest features.
Culture
Posts: 6
Joined: August 14th, 2009, 8:37 am

Delaying an Action

Post by Culture »

G'day,

I don't know if anyone else has this problem, but I've noticed over the past few iterations of my scripting that when using the mouseover/mouseleave actions, the mouseleave command in particular doesn't seem to want to play nice and refuses to execute the action I want it to.

For example...the following script displays a piece of text when I mouseover the button and hides it again when I mouseleave the button (well, it should, but then it's Friday evening and I have a drink at hand too :D ).

[MeterText]
Meter=STRING
.
.
.
Text=Some text here
Hidden=1

[MeterButton]
MeasureName=<Whatever>
Meter=ROUNDLINE
.
.
.
MouseOverAction=!execute [!RainmeterShowMeter MeterText][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter MeterText][!RainmeterRedraw]

I find that, while the mouseover action more often than not fires off and displays the text, the mouseleave action does not often hide the text again. It seems to me that the events that trigger these seem to either get lost somewhere or do not register and so do not get fired off, though I can't actually confirm this.

However, what if an event delay was deliberately introduced to put off the action for a specified period of time before it was executed?

What I would envisage are a few additional clauses that could be used where the mouse/button actions are used. The arguments for the clauses would be the time delay in milliseconds with perhaps a minimum delay of 100ms. These clauses could be, oh, I dunno, for the sake of the argument....

LeftMouseDownDelay
RightMouseDownDelay
LeftMouseUpDelay
RightMouseUpDelay
MouseOverDelay
MouseLeaveDelay


So, to introduce a 1 second delay in the execution of the mouseleave action for the above button meter script, it would look like...

[MeterButton]
.
.
.
MouseOverAction=!execute [!RainmeterShowMeter MeterText][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter MeterText][!RainmeterRedraw]
MouseLeaveDelay=1000

I have no idea if this would have uses for other things that use actions to be perfectly honest, but 'tis out of my head at any rate. Of course, if anyone has resolved this perceived issue or has an alternate solution, I'd be most pleased to hear about it.

Namaste
Culture
User avatar
Arne Anka
Posts: 100
Joined: April 18th, 2009, 11:31 am
Location: Sweden

Re: Delaying an Action

Post by Arne Anka »

Culture wrote:I don't know if anyone else has this problem, but I've noticed over the past few iterations of my scripting that when using the mouseover/mouseleave actions, the mouseleave command in particular doesn't seem to want to play nice and refuses to execute the action I want it to.

For example...the following script displays a piece of text when I mouseover the button and hides it again when I mouseleave the button (well, it should, but then it's Friday evening and I have a drink at hand too :D ).
Lucky you, it's only noon here... :?

Yes, there have been some mouseleave problems, but probably it's better now? At least here, since I upgraded to Rainmeter version 1.1 rev 213 (32-bit) (on XP SP3), the text disappears when leaving the button.
Livet är bara en period man ska överleva.
Som filosoferna säger: man föds, man lever och man dör ensam...
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Delaying an Action

Post by kenz0 »

If your point means that MouseLeaveAction events does not work well, Probably I guess that you just lacks the consideration to correctly work MouseLeaveAction events.
Unlike MouseOverAction, MouseLeaveAction certainly needs other area (not completely transparent window) in the direction to which a mouse is moved. so MouseLeaveAction will not work well if the skin is not made in consideration of this.
.
Image
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Delaying an Action

Post by dragonmage »

Kenz0 is correct. Rainmeter cannot tell if the mouse has left a meter if the mouse does not travel over another meter. If you have a meter floating over nothing (no background) then your mouse leaves the meter without hitting another meter, therefore Rainmeter doesn't know and doesn't trigger the MouseLeaveAction.

Now depending on how your skin should function there are a couple of things you can do to make it easier for Rainmeter to detect a MouseLeave.

If you create a transparent image behind your meter, that is a few pixels larger than your meter...

[Example]
Meter=Image
SolidColor=0,0,0,1 (the 1 is the alpha value and makes the image transparent to you but not to Rainmeter)

Rainmeter can better tell that the mouse has left your meter. There still may be times when you move the mouse too quickly for Rainmeter to detect the invisible meter. Again depending on how your skin should work this may be solved in a different way.

If your skin for example is a dock with text that appears when you mouseover the icons, then you can add a MouseOverAction to the background of the dock itself that hides ALL of the text meters. So as the mouse leaves the icon image and hits the background image the action to hide all is triggered. Then as the mouse hits the next icon image it triggers it's own text.

Hopefully my explanation is clear enough that you can work out a method that fits your needs.
Culture
Posts: 6
Joined: August 14th, 2009, 8:37 am

Re: Delaying an Action

Post by Culture »

I seeee...I understand what you're getting at Kenz0/DM...and, oh ho!, a bit of a lack of understanding/knowledge on my part I'm afraid. I'll have to set aside some time between this, that and the other to play with your suggestion and some other thoughts that've popped up.

Haven't loaded the latest version of the app yet either, might hunt that down and look to see how much it improves things first.

Have a good one.

Cheers all
Culture