It is currently May 7th, 2024, 9:21 am

Measure cursor position on the screen??

Get help with creating, editing & fixing problems with skins
luckyvictor
Posts: 5
Joined: January 6th, 2011, 4:55 pm

Measure cursor position on the screen??

Post by luckyvictor »

Hi all

I am trying to write a skin which somehow works in a similar way as taskbar or Dock. I would like to measure my cursor's X Y value on the screen, so when the desired value is below/above the threshold, I either show my skin or hide my skin.

I think I can call IfAboveValue or IfBelowValue to do this hide/show, but how to get the position of the mouse please?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure cursor position on the screen??

Post by jsmorley »

There is no way in native Rainmeter to determine the cursor position. Even if there was, it would be hideous. Rainmeter updates the values in a skin every Update= and assuming this is 1000 (one second) the information would be ancient in cursor movement terms anyway.

Without knowing specifically what you are trying to do, I can suggest a way to kinda get what you want.

Have a skin with a single small invisible meter like

[MeterDetectMouse]
Meter=Image
SolidColor=0,0,0,1
W=50
H=50
MouseOverAction=!Execute [!RainmeterActivateConfig MyConfig Skin2.ini]

Then in the actual skin you are "making visible" create some kind of "close" button with

[MeterClose]
Meter=Image
ImageName=Close.png
LeftMouseUpAction=!Execute [!RainmeterActivateConfig MyConfig Skin1.ini]

Or use a MouseLeaveAction in the second skin, but put it in the [Rainmeter] section of the skin so the skins in effect "toggle" as you move the mouse on and off them. This can be tricky since the skins are going to be different sizes. I prefer the "close button" approach.

The way Rainmeter works is that you can only have one skin from a single folder (config) loaded at a time, so when you activate the second one in the same folder, the first one is automatically closed, and visa versa. So what we are doing is creating an invisible "hotspot" that opens the "real" skin.

This is one approach. Another might be to actually use !RainmeterToggleConfig in a clever way in the two skins, might be worth playing with both to see which works best.

http://rainmeter.net/cms/Bangs_beta

Let me know if you need a better explanation or a little sample. It's not a perfect solution, but the only other alternative I can think of involves writing a plugin or addon, which gets complicated and still is going to have some issue with how you use the information on cursor position in a skin gracefully in any case.