It is currently March 29th, 2024, 11:41 am

Custom tooltip skin

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Custom tooltip skin

Post by balala »

Yincognito wrote: February 19th, 2020, 8:36 pm Nevermind, I finally got it done, and it's working perfectly, irrespective of the speed I'm hovering with the mouse.
Ok, I'm glad if it does.
Yincognito wrote: February 19th, 2020, 8:36 pm Your hints and jsmorley's ones actually helped, as I decided to get rid of the !WriteKeyValue bangs. I never liked having to use them anyway, for speed / performance considerations. Stay tune for the final code.
Probably not extremely needed to get rid of it. You can use both, !WriteKeyValue and !SetVariable bangs to make in the same time a dynamic and a permanent setting of the variable. Details for instance here: https://forum.rainmeter.net/viewtopic.php?f=5&t=32864&p=163870&hilit=writekeyvalue+setvariable#p163870
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Custom tooltip skin

Post by Yincognito »

balala wrote: February 19th, 2020, 8:48 pm Ok, I'm glad if it does.

Probably not extremely needed to get rid of it. You can use both, !WriteKeyValue and !SetVariable bangs to make in the same time a dynamic and a permanent setting of the variable. Details for instance here: https://forum.rainmeter.net/viewtopic.php?f=5&t=32864&p=163870&hilit=writekeyvalue+setvariable#p163870
Yeah, maybe. It's for the better anyway.
Now I can use (custom) tooltips in any fast updating skin (like animated ones), without them flickering due to being tied up to the parent skin's update rate. And of course, one can format the tooltip skin taking advantage of the whole set of options in Rainmeter. I'm just annoyed that I couldn't do this earlier - but then, I don't remember the StartHidden option in Rainmeter.ini being available sooner, as far as I was aware of.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Custom tooltip skin

Post by eclectic-tech »

Yincognito wrote: February 19th, 2020, 9:07 pm Yeah, maybe. It's for the better anyway.
Now I can use (custom) tooltips in any fast updating skin (like animated ones), without them flickering due to being tied up to the parent skin's update rate. And of course, one can format the tooltip skin taking advantage of the whole set of options in Rainmeter. I'm just annoyed that I couldn't do this earlier - but then, I don't remember the StartHidden option in Rainmeter.ini being available sooner, as far as I was aware of.
You have this working great, nicely done! :thumbup:

StartHidden has been around for a long time, but I have not seen it utilized in very many skins; it saves having to define all your meters with Hidden=1 in the initial code.

As you mentioned, it is also possible to create custom looking tool tips. If I may suggest, you could also use Brian's SysColor plugin to have the tool tip style match the system colors for tool tip background and tool tip text (although some people resist using external dll's).

Your 'Tooltip.ini' was not showing the Tool tip Title, so here is the code that uses SysColor.dll to match the system colors and shows the tooltip title.

Tooltip.ini

Code: Select all

[Variables]
MouseCursorSize=24

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

BackgroundMode=2
SolidColor=[MS_TooltipBackground]

---Measures Rainmeter---

[MS_TooltipBackground]
Measure=Plugin
Plugin=SysColor.dll
ColorType=ToolTipBackground

[MS_TooltipText]
Measure=Plugin
Plugin=SysColor.dll
ColorType=ToolTipText

[MS_Rainmeter_ParentX]
Group=TooltipGroup
Measure=Calc
Formula=0
UpdateDivider=-1
DynamicVariables=1

[MS_Rainmeter_ParentY]
Group=TooltipGroup
Measure=Calc
Formula=0
UpdateDivider=-1
DynamicVariables=1

[MS_Rainmeter_ParentWidth]
Group=TooltipGroup
Measure=Calc
Formula=0
UpdateDivider=-1
DynamicVariables=1

[MS_Rainmeter_ParentHeight]
Group=TooltipGroup
Measure=Calc
Formula=0
UpdateDivider=-1
DynamicVariables=1

[MS_Rainmeter_MoveTooltip]
Group=TooltipGroup
Measure=Calc
UpdateDivider=-1
IfCondition=(#CURRENTCONFIGWIDTH#>10)
IfTrueAction=[!Move "((([MS_Rainmeter_ParentX]+#CURRENTCONFIGWIDTH#)>(#WORKAREAX#+#WORKAREAWIDTH#))?([MS_Rainmeter_ParentX]-(#CURRENTCONFIGWIDTH#-[MS_Rainmeter_ParentWidth])):([MS_Rainmeter_ParentX]))" "((([MS_Rainmeter_ParentY]+[MS_Rainmeter_ParentHeight]+#MouseCursorSize#+#CURRENTCONFIGHEIGHT#)>(#WORKAREAY#+#WORKAREAHEIGHT#))?([MS_Rainmeter_ParentY]-#MouseCursorSize#-#CURRENTCONFIGHEIGHT#):([MS_Rainmeter_ParentY]+[MS_Rainmeter_ParentHeight]+#MouseCursorSize#))"][!Show]
IfConditionMode=1
DynamicVariables=1

---Meters---

[MT_Rainmeter_TooltipTitle]
Group=TooltipGroup
Meter=STRING
FontFace=Consolas
StringStyle=Bold
FontColor=[MS_TooltipText]
DynamicVariables=1
SolidColor=[MS_TooltipBackground]
Padding=5,5,5,5
AntiAlias=1
Text=
UpdateDivider=-1

[MT_Rainmeter_TooltipText]
Group=TooltipGroup
Meter=STRING
Y=R
FontFace=Consolas
FontColor=[MS_TooltipText]
DynamicVariables=1
SolidColor=[MS_TooltipBackground]
Padding=5,5,5,5
AntiAlias=1
Text=
UpdateDivider=-1
tt2.gif
I will be looking at using this in some of my visualizer skins.
Thanks for sharing! :great:
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Custom tooltip skin

Post by Yincognito »

eclectic-tech wrote: February 20th, 2020, 1:41 amYou have this working great, nicely done! :thumbup:
Many thanks for the appreciation, eclectic-tech. Coming from you, this means a lot. :rosegift:
eclectic-tech wrote: February 20th, 2020, 1:41 amStartHidden has been around for a long time, but I have not seen it utilized in very many skins; it saves having to define all your meters with Hidden=1 in the initial code.
Really? That means I overlooked the option when I first started to work on this and wrote the initial post. Thing is, I was looking for it in the Bangs section (where similar stuff like setting the ZPos exist), and probably didn't thought to check if a Rainmeter.ini option that I could edit existed. Fortunately, I discovered it eventually, and it was just what I needed. In my implementation, I entirely removed the !WriteKeyValue bang used to set this option, since I will save this in both Layouts I provide with my skin suite (meaning that if that option dissapears or gets edited for some reason, a simple Layout loading will restore it, without having to write it to Rainmeter.ini each time I hover the mouse to show a tooltip).
eclectic-tech wrote: February 20th, 2020, 1:41 amYour 'Tooltip.ini' was not showing the Tool tip Title, so here is the code that uses SysColor.dll to match the system colors and shows the tooltip title.
Yeah, my bad, forgot to add a Y=0R option to the "Tooltip Text" meter in Tooltip.ini, so the content of the tooltip was in effect drawn over the title, that's all. I didn't have my mind on noticing these details (especially since I was also working with my actual skin suite, where the styles were already set up properly and the title was displayed), I was focused on getting the position of the tooltip right. As explained, the first draw of the tooltip (the hidden one) is used to get the tooltip's dynamic dimensions in order to compute its position, and only then it is followed by the tooltip's actual appearance on the screen. The first (hidden) draw has therefore 3 benefits: it allows getting the tooltip skin's (dynamic or not) dimensions by updating the meters first, it hides the tooltip while it's drawn in the "wrong" position initially, and it effectively loads the skin so that a !SetOption bang, for example, can do its job (because obviously a skin has to be loaded before being able to dynamically change it from memory).
eclectic-tech wrote: February 20th, 2020, 1:41 amAs you mentioned, it is also possible to create custom looking tool tips. If I may suggest, you could also use Brian's SysColor plugin to have the tool tip style match the system colors for tool tip background and tool tip text (although some people resist using external dll's).
Or, one could just google what is the RGB of a tooltip's background color and use it just like any other color in Rainmeter. ;-)
Which brings me to my next problem, somewhat related to this, LOL. For some reason, even though I set the font of the tooltip skin the same as the one used in the OS's tooltips (i.e. Segoe UI size 9), my Unicode character strategy of text alignment fails. I've checked in MS Word as well, it seems the "Segoe UI" OS tooltip font is somehow "modified" while being displayed in the OS's tooltips, because otherwise using the exact same font, size, effects, etc. in a Rainmeter skin shouldn't break my previously precise Unicode alignment that worked so well in an actual operating system tooltip. But then again, those MS folks do some things... :?

Of course, I could just use the Rainmeter capabilities to create a custom looking skin, but while this might be a good idea in the case of 1 or 2 parent skins, I would like to avoid designing a different looking custom tooltip for each one of my 13 or so parent skins in my suite, therefore I'm (still) trying to make a "universal" tooltip layout for all of them. Well, in the end, at least one objective is completed: the tooltip doesn't depend (as much) on the update rate of the parent skin anymore - and this makes it ideal in case of animations, in order to avoid tooltip flickering.
eclectic-tech wrote: February 20th, 2020, 1:41 amI will be looking at using this in some of my visualizer skins.
Thanks for sharing! :great:
It was my pleasure - go ahead and make some good use of this! I know I will (after I figure out how to solve related issue like the one above, that is)! 8-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Custom tooltip skin

Post by Yincognito »

I discovered something while playing with a "fully featured" custom tooltip skin that has images in it (like a ToolTipIcon equivalent, for example) and meters aligning to the images using the r / R relative positioning: the W and H options of the image meters must be set to 0 in the tooltip skin (along with the ImageName set to nothing - just like the Text option of the String meters is set to nothing above), and everything about populating those options (not just ImageName, but also W and H) with the actual values must be done from the parent skin.

If you don't, the tooltip skin will not be hidden when it is first drawn in the "wrong" position, and although the movement to the right position will take place, this operation will be visible and not "behind the scenes" (as it's supposed to happen). By the way, this behavior will only happen when the parent skin is at the edges of the screen area and the tooltip "doesn't fit" completely up to those edges (and is moved to fit within the screen area as a result). Otherwise, when there is place for the tooltip skin to fit inside the screen area (when the parent skin is further away from the edges, for example), no such behavior will happen.

HINT: If you don't want to set the W and H on the image meter (i.e. you want them to stay blank in order for the meter to automatically adapt to the image dimensions - horizontally, vertically or both), use a MeterStyle to restore the "blank" option, as explained in the SetOption guide here. For example, say one has an unknown size image that needs to be displayed in the tooltip skin at its original dimensions (and not some hardcoded ones); all that needs to be done is:
- set a MeterStyle for the image meter (either in the tooltip skin or in an .inc that the tooltip skin uses) where W and/or H are either omitted or explicitly set to nothing
- set the W and/or H to 0 in the tooltip skin, right after the MeterStyle=... option of the image meter
- use a !SetOption bang from the measure that populates the tooltip in the parent skin to set the W and/or H to "", thus allowing the MeterStyle setting on the image meter to again control those options

Thankfully, I solved this issue much faster than the rest of the issues that make up this thread. Kudos to the Rainmeter manual (and its authors) :great:

UPDATE: So, after overcoming another little issue with images (for some reason, the .ico in the skin didn't like more than 1px of left padding - now I'm not even sure it's strictly about images or that an image applied to the sample above would cause issues, as I perform other visual enhancements in my own tooltip skin version, like a custom width bevel, so this might interfere somehow), this is what you can do with it - it's time for my own preview (OS tooltip at the top, custom one using multirow title, inline options and a monospaced font for right-alignment at the bottom) - notice that changing position at the edges of the screen area works smoothly:
Custom Tooltip Skin Demo.gif
UPDATE 2: Forget about the images issue, I figured out why that happened and how to solve it once and for all: it was just a matter of moving the [!Redraw "#ROOTCONFIG#\Tooltip"] before the update of the tooltip skin's measures, in the measure that populates the tooltip. This, along with a couple of changes (switching back to variables as it's less code to write) and one or two variables to properly check things before acting in a certain way solved it - no need for the above precautions anymore when using images with padding or relative positioning towards them. The "final product" has been moved to the "Tips & Tricks" section of the forum, to (hopefully) help others as well.

UPDATE 3: I really hate to change my statements like that but apparently, there is something going on regarding images with undefined dimensions, padding, dynamic variables and relative positioning towards them. It turns out that the issues I mentioned here had nothing to do with my code, but rather with the way Rainmeter works. Anyway, the good thing is that there are multiple workarounds for this little annoyance, and they're all mentioned in the note at the bottom of the "Tips & Tricks" post on this.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

Re: Custom tooltip skin

Post by Judian81 »

hey hello,

i have used your tooltip skin for a lot of skins. and i think it is beautifull.

tooltip.png
tooltip 2.png

this works fine. and i do not know why. but sometimes one of the skins do work and others will not work.
to solve the problem i realy have to close rainmeter and start it again.
the error message i get when one of the skins will not work is this.


tooltip error.png


the performance skin works great. the uptime skin do not work. but normaly works just fine.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Custom tooltip skin

Post by Yincognito »

Judian81 wrote: August 2nd, 2022, 6:54 pm hey hello,

i have used your tooltip skin for a lot of skins. and i think it is beautifull.

this works fine. and i do not know why. but sometimes one of the skins do work and others will not work.
to solve the problem i realy have to close rainmeter and start it again.
the error message i get when one of the skins will not work is this.

the performance skin works great. the uptime skin do not work. but normaly works just fine.
Well, I'm glad you found it useful - I use the system as well, ever since I explained it here, and I'm very happy with it, in fact I don't use the classic tooltips anymore whatsoever, as the advantages of the custom ones are hard to match by the standard ones. 8-)

If what you see is what I'm thinking, it's more or less "normal", as in harmless and having a workaround that always works to (temporarily) fix it ... until it happens again, that is. I even posted a bug report about the whole thing a while ago, but unfortunately, given that this happens quite rarely and on an apparent "random" basis (since it's unknown precisely what is causing it or what are the steps to reproduce it), it's quite hard to replicate by the developers. They would have to use the custom tooltip system almost all the time in order to have a chance of see the issue happening.

In short, in certain - but unknown, as of now - conditions, the tooltip skin will enter a "missing" / "unloaded" / "loaded" state, depending on which Rainmeter part you're looking at (e.g. will be missing in the Log, unloaded in the Manage Rainmeter window, and loaded according to the context menu "dot" ... all of them at the same time!). Restarting Rainmeter is not required to fix it, you can do it much easier just by clicking on the associated context menu "dot" to unload the tooltip skin, after which it will work again:
Yincognito wrote: July 7th, 2020, 5:19 pmUPDATE: Clicking on the skin's name from the context menu (like highlighted in the screenshot above) in order to unload it seems to have (temporarily, i.e. until it'll happen again, a couple of days or weeks from now or so) solved the issue, no Rainmeter restart needed. I wonder what would have happened if I tried to click on the Load button in the Manage Rainmeter window, since the skin was there seen as unloaded and the Unload button was dimmed / disabled...
Basically, the weird "multi-state" that happens needs to be reset to a "single-state" as it should be, in order to have things working again as usual. It's a small annoyance to have this happening every once it a while, but without definitive steps to reproduce it, it's difficult to pinpoint exactly what is the cause and how to correct it. Maybe you will be the one to get lucky and find out how to reproduce it - if you do, don't hesitate to post here or on the other thread so the devs can have something to work with. ;-)

P.S. If I were to guess, I'd say this could be related to how fast things are happening in the custom tooltip system, or some other similar cause, but obviously I can't be sure about it. What I can guarantee - and you probably could do it as well, after using the approach for some time - is that the code is correct. If that wasn't true, then the issue would have happened every time, which clearly isn't the case. :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

Re: Custom tooltip skin

Post by Judian81 »

thanks for the reaction. :thumbup:
your explanation about unloading the tooltip for the skin that seems to be not working. is correct. when i unload the tooltip and hover over the skin it will work right away. i will monitor this for a while. i use 14 skins that have this option included.

i do not know if this is true. but is there an option to unload the tooltip before it want load it?!
an other way is it possible to hide and unhide the tooltip skin!?

edit 1:

i already tryed unloading the skin to make it right. but that trick did not work. so that was the reason to close and restart rainmeter.
i will try to relocate the tooltip.ini file to see what are the effects of that.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Custom tooltip skin

Post by Yincognito »

Judian81 wrote: August 3rd, 2022, 4:10 pm thanks for the reaction. :thumbup:
your explanation about unloading the tooltip for the skin that seems to be not working. is correct. when i unload the tooltip and hover over the skin it will work right away. i will monitor this for a while. i use 14 skins that have this option included.

i do not know if this is true. but is there an option to unload the tooltip before it want load it?!
an other way is it possible to hide and unhide the tooltip skin!?

edit 1:

i already tryed unloading the skin to make it right. but that trick did not work. so that was the reason to close and restart rainmeter.
i will try to relocate the tooltip.ini file to see what are the effects of that.
So, after all, is unloading from the context menu "dot" (to the right in the image) working for you or not? Cause it's not clear from your reply... :???:
Image

As for your questions, unloading before loading is possible by using the !Deactivate and !Activate bangs one after another, like [!DeactivateConfig "#ROOTCONFIG#\Tooltip"][!ActivateConfig "#ROOTCONFIG#\Tooltip"], optionally with a !Delay between them if needed. Apart from !Show and !Hide, you can probably hide and unhide a skin via !SetTransparency to min and max or something similar.

Other than that, I assumed your error was caused by the same thing as mine - if it's not, then obviously the "dot" unload solution won't work. It also depends on what "version" of the tooltip skin system you have and if the code there is similar to the code in my case. If these two are similar, then the unload workaround should work for you, without having to restart Rainmeter. I never restart it to fix this, when getting this error. Of course, sooner or later the error will occur again for some reason, but the "dot" unload trick works every time to get rid of the problem (until next time it happens).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

Re: Custom tooltip skin

Post by Judian81 »

Yincognito wrote: August 3rd, 2022, 5:33 pm So, after all, is unloading from the context menu "dot" (to the right in the image) working for you or not?
unloading is good 2.png
yes it works great. i change the skin to another location. just like you have. i can unload the skin when it is not visable on the screen.

guess it has something to do with the delay, but i am not totaly sure.
i will keep up the post if i find something or not.

have a nice day
You do not have the required permissions to view the files attached to this post.