It is currently March 29th, 2024, 1:51 am

MouseOver Icon changes More ToolTip help

Get help with creating, editing & fixing problems with skins
DuckSlaps
Posts: 5
Joined: June 18th, 2020, 10:05 pm

MouseOver Icon changes More ToolTip help

Post by DuckSlaps »

Hello again everyone,
I'm working on a battery skin that will cycle through four icons depending on the current battery's percentage and I think I have that part of the code set. However, I've been setting up all of my skins to turn from an outlined icon to a colorized version of the same icon on mouseover. Is it possible to set something up like that given that my battery skin has variable image name values to be automatically set based on my battery percent?

Here is how I have the Battery Measure set up

Code: Select all

[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent
IfCondition=(MeasureBatteryPercent <= 25)
IfTrueAction=[!SetOption MeterBattery "ImageName" "#@#Icons\low battery outline.png"][!Redraw]
IfCondition2=(MeasureBatteryPercent >= 26) && (MeasureBatteryPercent <=65)
IfTrueAction2=[!SetOption MeterBackground "ImageName" "#@#Images\med battery outline.png"][!Redraw]
IfCondition3=(MeasureBatteryPercent >=66) && (MeasureBatteryPercent <= 89)
IfTrueAction3=[!SetOption MeterBackground "ImageName" "#@#Icons\high battery outline.png"][!Redraw]
IfCondition4=(MeasureBatteryPercent >= 90)
IfTrueAction4=[!SetOption MeterBackground "ImageName" "#@#Icons\full battery outline.png"][!Redraw]
And I typically have been able to use this to change my icons from just outlines to color, but it seems to me like this would override the battery percent measure I've got set up.

Code: Select all

MouseOverAction=[!SetOption "#CURRENTSECTION#" ImageName "#@#icons\full battery color.png][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption "#CURRENTSECTION#" ImageName "#@#icons\full battery outline.png][!UpdateMeter "#CURRENTSECTION#"][!Redraw]


Secondarily, is Rainmeter capable of measuring the time left on my laptop's current charge? I'm trying to add a tooltip that will display current charge percentage and time left on the charge. I've been able to figure out the charge percent tooltip, but I can't figure out how to get it to display life left. I found the power plugin tutorial on the rainmeter main website and have coded this measure

Code: Select all

[MeasureBatteryTime]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Lifeime
Format="%#H hr %M min remaining"
and tooltip

Code: Select all

ToolTipType=1
ToolTipTitle="Battery"
ToolTipText="[MeasureBatteryPercent]% #CRLF#[MeasureBatteryTime]%1"
Sorry for the super long and involved question, this has been my latest quarantine hobby and I'm probably biting off more than I can chew. :uhuh:
User avatar
Halloyo
Posts: 31
Joined: June 17th, 2020, 3:08 am

Re: MouseOver Icon changes More ToolTip help

Post by Halloyo »

I'm not sure I fully understand the first part, with the icons and the outlines. Your icons change from outlines to colored depending on battery status? I'm no expert, but from what I see, there should be no problem. Have you tested it?

Anyway, there is no problem with the lifetime code you have written, but since it is a measure, it will not be displayed. You need to write a separate meter to display that measure.

Example:

Code: Select all

[MeterBatteryTime]
Meter=String
MeasureName=MeasureBatteryTime
Antialias=1
Obviously, you'll nee to position it, etc.
DuckSlaps
Posts: 5
Joined: June 18th, 2020, 10:05 pm

Re: MouseOver Icon changes More ToolTip help

Post by DuckSlaps »

I'm sorry, I wasn't entirely clear. For the rest of the skins I've been using on my desktop, each skin has two icons - one that is just an outline and one that is the same thing but colored in. When I mouse over the image it will redraw the skin to be the colored icon, and when I pull my mouse off of the image it will revert back to the outlined image. Like this:
icons.gif

So my confusion is because it doesn't seem to be as simple as changing between two static images, which I've been able to successfully do. As the battery skin is written to be dynamic based on current operating battery levels, I'm not sure if I would be able to enable a mouse over effect without messing up/interfering with the battery level related image language.


Also, I'm trying to get the Battery time measure to display as a tooltip, rather than an independent part of the meter. My ultimate goal would be to have everything in a way that once I mouse over the battery icon it will: change from an outlined icon to one filled with color and display a tooltip that includes the current battery percentage and estimated time left on the current charge.

My battery meter looks as follows:

Code: Select all

[MeterBattery]
Meter=Image
ImageName=#@#icons\low battery outline.png
H=50
AntiAliasing=1
DynamicVariables=1
ToolTipType=1
ToolTipTitle="Battery"
ToolTipText="[MeasureBatteryPercent]% #CRLF#[MeasureBatteryTime]%1"
As it stands the tooltip that pops up on mouse over accurately displays the battery percentage, but says "0%1" on the second line related to [MeasureBatteryTime].


I'm sorry if this is a lot, I can post the entire skin .ini file contents if it might help.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MouseOver Icon changes More ToolTip help

Post by balala »

DuckSlaps wrote: June 20th, 2020, 11:18 pm I'm working on a battery skin that will cycle through four icons depending on the current battery's percentage and I think I have that part of the code set. However, I've been setting up all of my skins to turn from an outlined icon to a colorized version of the same icon on mouseover. Is it possible to set something up like that given that my battery skin has variable image name values to be automatically set based on my battery percent?
It definitely is and there are even more possibilities, here is one of them. You have to create a variable, let's name it MouseOver. Its value is gonna change when you're hovering the mouse over the skin, respectively when you're leaving it. So, first add the variable to the [Variables] section, beside the already existing variables (if there are any):

Code: Select all

[Variables]
...
MouseOver=0
Now modify the MouseOverAction and MouseLeaveAction options of the appropriate Image meter, as it follows:

Code: Select all

[MeterBattery]
...
MouseOverAction=[!SetVariable MouseOver "1"][!UpdateMeasure "MeasureBatteryPercent"]
MouseLeaveAction=[!SetVariable MouseOver "0"][!UpdateMeasure "MeasureBatteryPercent"]
Finally you have to modify the IfConditions of the [MeasureBatteryPercent] measure:

Code: Select all

[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent
IfCondition=((MeasureBatteryPercent <= 25)&&(#MouseOver#=0))
IfTrueAction=[!SetOption MeterBattery "ImageName" "#@#Icons\low battery outline.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition2=((MeasureBatteryPercent <= 25)&&(#MouseOver#>=1))
IfTrueAction2=[!SetOption MeterBattery "ImageName" "#@#Icons\low battery.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition3=((MeasureBatteryPercent >= 26) && (MeasureBatteryPercent <=65)&&(#MouseOver#=0))
IfTrueAction3=[!SetOption MeterBackground "ImageName" "#@#Images\med battery outline.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition4=((MeasureBatteryPercent >= 26) && (MeasureBatteryPercent <=65)&&(#MouseOver#>=1))
IfTrueAction4=[!SetOption MeterBackground "ImageName" "#@#Images\med battery.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition5=((MeasureBatteryPercent >=66) && (MeasureBatteryPercent <= 89)&&(#MouseOver#=0))
IfTrueAction5=[!SetOption MeterBackground "ImageName" "#@#Icons\high battery outline.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition6=((MeasureBatteryPercent >=66) && (MeasureBatteryPercent <= 89)&&(#MouseOver#>=1))
IfTrueAction6=[!SetOption MeterBackground "ImageName" "#@#Icons\high battery.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition7=((MeasureBatteryPercent >= 90)&&(#MouseOver#=0))
IfTrueAction7=[!SetOption MeterBackground "ImageName" "#@#Icons\full battery outline.png"][!UpdateMeter "MeterBattery"][!Redraw]
IfCondition8=((MeasureBatteryPercent >= 90)&&(#MouseOver#>=1))
IfTrueAction8=[!SetOption MeterBackground "ImageName" "#@#Icons\full battery.png"][!UpdateMeter "MeterBattery"][!Redraw]
DynamicVariables=1
Note the followings:
  • I added a DynamicVariables=1 option, it being needed because we have there a dynamically changing variable (MouseOver) and this requires to set the dynamic variables on.
  • I added a [!UpdateMeter "MeterBattery"] bang to each IfTrueAction (beside the [!Redraw]), because for an instant change of the image, beside redrawing the skin, you also have to update the appropriate meter (in this case [MeterBattery]). If you don't update the meter, doesn't worth to redraw the skin.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MouseOver Icon changes More ToolTip help

Post by balala »

Halloyo wrote: June 21st, 2020, 1:06 am Anyway, there is no problem with the lifetime code you have written,
In fact there is. There is a typo in the PowerState option of the [MeasureBatteryTime] measure. A t is missing: the posted option look like this: PowerState=Lifeime, but should be PowerState=Lifetime.

On the other hand DuckSlaps, take care about those typos, there are more. For instance beside the above one, the AntiAlias=1 option of the last posted [MeterBattery] meter is miswritten as AntiAliasing=1.
Take care about all this mistakes, they can give you a lot of headache over time.
DuckSlaps
Posts: 5
Joined: June 18th, 2020, 10:05 pm

Re: MouseOver Icon changes More ToolTip help

Post by DuckSlaps »

Balala, thank you for your help yet again. This is working perfectly! I will certainly be on the lookout for mistakes and typos, and will be triple-checking my .ini files for them from here on out. While another set of eyes such as yours certainly helps, taking a moment to slow down and review might help me troubleshoot some of my problems on my own.
Thank you again, this forum has proven to be invaluable in taking the step from downloading skins and using them as is to creating my own to be just how I'd like them!

Take care :great:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MouseOver Icon changes More ToolTip help

Post by balala »

DuckSlaps wrote: June 21st, 2020, 4:36 pm I will certainly be on the lookout for mistakes and typos, and will be triple-checking my .ini files for them from here on out. While another set of eyes such as yours certainly helps, taking a moment to slow down and review might help me troubleshoot some of my problems on my own.
Thank you again, this forum has proven to be invaluable in taking the step from downloading skins and using them as is to creating my own to be just how I'd like them!
:thumbup: