It is currently March 29th, 2024, 2:30 pm

Mouse Hovering

Get help with creating, editing & fixing problems with skins
Krakon
Posts: 2
Joined: February 13th, 2012, 12:47 am

Mouse Hovering

Post by Krakon »

Hello im making a rainmeter skin which I have an image and when i hover my mouse on it it changes the image is that possible please?
I tried searching but all i found was
MouseOverAction
MouseLeaveAction
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Mouse Hovering

Post by jsmorley »

You are on the right track. MouseOverAction and MouseLeaveAction are the keys. The question then is - how are you determining what image is used for what?

If, at its most simple, you just want two defined images and want to toggle between them when you mouse over the image(s), then:

Code: Select all

[Rainmeter]
Update=1000

[MeterImage]
Meter=Image
ImageName=#CURRENTPATH#Image1.png
MouseOverAction=!Execute [!SetOption #CURRENTSECTION# ImageName "#CURRENTPATH#Image2.png"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=!Execute [!SetOption #CURRENTSECTION# ImageName "#CURRENTPATH#Image1.png"][!UpdateMeter #CURRENTSECTION#][!Redraw]
The !UpdateMeter and !Redraw stuff is just to make it really responsive without setting the overall Update of the skin low, which if this in included in a bigger skin doing all kinds of other things, can use some CPU. If this functionality will be in its own skin, you can lose that stuff and just set the skin's Update to 100 or 300 or whatever works for you.
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Mouse Hovering

Post by Brian »

You are right on the money. To change the image, check out !SetOption bang. You would use it like this: MouseOverAction=!SetOption YourImageMeter ImageName SomeImage.png, where "YourImageMeter" is the meter you are using for your image, and "SomeImage.png" is the image you want to replace the current one. Then you can do a MouseLeaveAction=!SetOption YourImageMeter ImageName Original.png, where "Original.png" is the original image in your image meter.

Hope that makes sense. Here is some more information on !SetOption.

-Brian

EDIT: JSMorley wins again!
User avatar
MaroonED
Posts: 61
Joined: November 6th, 2011, 4:50 pm
Location: Germany

Re: Mouse Hovering

Post by MaroonED »

Krakon,
if you use the same images all the time, you could use a BUTTON meter. A button consists of three images joined together. One is the default image, one is shown when the left button is pressed and one when the cursor is over it. Here's an example of a button that'll light up when hovered over if you use it in a BUTTON meter. The middle image is the one shown when the mouse button is pressed - in my example it stays the same as when you hover over it.

MaroonED
You do not have the required permissions to view the files attached to this post.
Krakon
Posts: 2
Joined: February 13th, 2012, 12:47 am

Re: Mouse Hovering

Post by Krakon »

Thanks for replying you really helped ty ^^
STEAMMANNXS
Posts: 1
Joined: July 23rd, 2018, 9:28 pm

Re: Mouse Hovering

Post by STEAMMANNXS »

MaroonED wrote:Krakon,
if you use the same images all the time, you could use a BUTTON meter. A button consists of three images joined together. One is the default image, one is shown when the left button is pressed and one when the cursor is over it. Here's an example of a button that'll light up when hovered over if you use it in a BUTTON meter. The middle image is the one shown when the mouse button is pressed - in my example it stays the same as when you hover over it.

MaroonED

I've been looking for this so long by now... I did use that solution in the past for a multiple "three stages icons" image for a skin I made to easily open all the folders I needed when modding for Fallout 4. Unfortunately I changed computer and for some reason I've lost the skin, I could retrieve only an old version of the image with the multiple icons.
I've been looking for a guide to recreate the same skin but in vain. I wonder if you would share the solution with exactly the needed code...


Thanks so much!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Mouse Hovering

Post by eclectic-tech »

STEAMMANNXS wrote:I've been looking for this so long by now... I did use that solution in the past for a multiple "three stages icons" image for a skin I made to easily open all the folders I needed when modding for Fallout 4. Unfortunately I changed computer and for some reason I've lost the skin, I could retrieve only an old version of the image with the multiple icons.
I've been looking for a guide to recreate the same skin but in vain. I wonder if you would share the solution with exactly the needed code...


Thanks so much!
The button meter tip should have all the information you need... if you still have questions about button meters, feel free to ask.