It is currently April 8th, 2020, 2:46 pm

Tooltip hot-spot

Report bugs with the Rainmeter application and suggest features.
User avatar
balala
Rainmeter Sage
Posts: 10094
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tooltip hot-spot

Post by balala »

Yincognito wrote:
March 15th, 2020, 2:42 pm
Disadvantages that should be fixed? LOL, that's absurd.
Yes, I admitted previously more times my English is not perfect. In fact is far away from being good at least. But right now this is everything I can. I'm glad yours is much better, but this is it.
User avatar
Yincognito
Posts: 1152
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Tooltip hot-spot

Post by Yincognito »

balala wrote:
March 15th, 2020, 2:52 pm
Finally probably everyone is free to use whatever approach he wants. I'm also using one which matches my needs. You didn't convinced me, but this is my problem.
End of discussion, from my point of view. I can't BUT DON'T EVEN WANT to convince you Tooltip is anyway better (or anything else).
No need to take this to heart, my friend. ;-) I didn't. It's just that sometimes is hard to even talk about alternatives when one doesn't want to see their ease of use.
balala wrote:
March 15th, 2020, 2:55 pm
Yes, I admitted previously more times my English is not perfect. In fact is far away from being good at least. But right now this is everything I can. I'm glad yours is much better, but this is it.
Here you are again, taking this to heart. :( I was not talking about your English, balala. I was talking about the fact that neither choice one has is free of disadvantages. They always exist, just like the advantages, and can't be "fixed", only "minimized". And minimizing them in the context of my custom tooltip implementation is impossible, for the simple reason that I already did everything in my power to do that.
Last edited by Yincognito on March 15th, 2020, 3:04 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 20457
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Tooltip hot-spot

Post by jsmorley »

Yincognito wrote:
March 15th, 2020, 2:54 pm
So, isn't the amount of code required for that "sliding panel" comparable to the amount of code required for my custom tooltip approach? I'm not talking about things one can just copy paste, but about the code that's (often) subject to change.
I wasn't talking about the comparative simplicity or the amount of code required. My point was that I don't like "tooltips" for displaying a lot of real-time information in any case. That isn't the idea behind them, and you won't find a single place in Windows where they are used that way. I propose that you are using complicated tooltips in order to save "real-estate" in your skin, and I think there are other, less annoying, ways to accomplish that.

Tooltips are "hints". Think "What is this button?".

Still, to each his own as always.
User avatar
jsmorley
Developer
Posts: 20457
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Tooltip hot-spot

Post by jsmorley »

Mind you, that's not to say I have not been guilty of over-using tooltips myself... ;-)


1.jpg


2.jpg

3.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Posts: 1152
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Tooltip hot-spot

Post by Yincognito »

jsmorley wrote:
March 15th, 2020, 3:02 pm
I think there are other, less annoying, ways to accomplish that.
Agreed, but only a tooltip simulation doesn't lose "space", especially when you don't have any. All the other ways involve either enlarging the skin (show/hide meter variants), or (in your case) not being able to display larger amounts of data with virtually no space lost. I didn't choose what I chose because I thought it was better or less annoying than other choices - I did that because I had to (since no other option allows larger data quantity display without "stealing" screen space).
jsmorley wrote:
March 15th, 2020, 3:11 pm
Mind you, that's not to say I have not been guilty of over-using tooltips myself... ;-)
Sure thing. :) By the way, the left alignment of number values is by any chance done using Unicode characters? :D
User avatar
jsmorley
Developer
Posts: 20457
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Tooltip hot-spot

Post by jsmorley »

Yincognito wrote:
March 15th, 2020, 3:19 pm
Agreed, but only a tooltip simulation doesn't lose "space", especially when you don't have any. All the other ways involve either enlarging the skin (show/hide meter variants), or (in your case) not being able to display larger amounts of data with virtually no space lost. I didn't choose what I chose because I thought it was better or less annoying than other choices - I did that because I had to (since no other option allows larger data quantity display without "stealing" screen space).


Sure thing. :) By the way, the left alignment of number values is by any chance done using Unicode characters? :D
Nope, just tabs...

Code: Select all

ToolTipTitle=System Memory
ToolTipType=1
ToolTipIcon=#ImagePath#Ram.ico
ToolTipText=#CRLF#Physical Total	#PhysicalTotal##CRLF#Physical Used	#PhysicalUsed##CRLF#Physical Free	#PhysicalFree##CRLF##CRLF#Swap Total	#SwapTotal##CRLF#Swap Used	#SwapUsed##CRLF#Swap Free	#SwapFree##CRLF##CRLF#Page Total	#PageTotal##CRLF#Page Used	#PageUsed##CRLF#Page Free	#PageFree#

I use some Lua to "autoscale" the values for use in a Tooltip, which doesn't support scaling in TooltipText.

Code: Select all

function Initialize()

	msPhysicalTotal = SKIN:GetMeasure('MeasurePhysMemTotal')
	msPhysicalUsed = SKIN:GetMeasure('MeasurePhysMemUsed')
	msPhysicalFree = SKIN:GetMeasure('MeasurePhysMemFree')
	msSwapTotal = SKIN:GetMeasure('MeasureSwapMemTotal')
	msSwapUsed = SKIN:GetMeasure('MeasureSwapMemUsed')
	msSwapFree = SKIN:GetMeasure('MeasureSwapMemFree')
	msPageTotal = SKIN:GetMeasure('MeasurePageTotal')
	msPageUsed = SKIN:GetMeasure('MeasurePageUsed')
	msPageFree = SKIN:GetMeasure('MeasurePageFree')	
	
end

function Update()

	physicalTotal, s1 = AutoScale(msPhysicalTotal:GetValue(),1)
	physicalUsed, s2 = AutoScale(msPhysicalUsed:GetValue(),1)
	physicalFree, s3 = AutoScale(msPhysicalFree:GetValue(),1)
	SKIN:Bang('!SetVariable', 'PhysicalTotal', physicalTotal .. ' ' ..s1)
	SKIN:Bang('!SetVariable', 'PhysicalUsed', physicalUsed .. ' ' ..s2)
	SKIN:Bang('!SetVariable', 'PhysicalFree', physicalFree .. ' ' ..s3)
	SwapTotal, s1 = AutoScale(msSwapTotal:GetValue(),1)
	SwapUsed, s2 = AutoScale(msSwapUsed:GetValue(),1)
	SwapFree, s3 = AutoScale(msSwapFree:GetValue(),1)
	SKIN:Bang('!SetVariable', 'SwapTotal', SwapTotal .. ' ' ..s1)
	SKIN:Bang('!SetVariable', 'SwapUsed', SwapUsed .. ' ' ..s2)
	SKIN:Bang('!SetVariable', 'SwapFree', SwapFree .. ' ' ..s3)
	PageTotal, s1 = AutoScale(msPageTotal:GetValue(),1)
	PageUsed, s2 = AutoScale(msPageUsed:GetValue(),1)
	PageFree, s3 = AutoScale(msPageFree:GetValue(),1)
	SKIN:Bang('!SetVariable', 'PageTotal', PageTotal .. ' ' ..s1)
	SKIN:Bang('!SetVariable', 'PageUsed', PageUsed .. ' ' ..s2)
	SKIN:Bang('!SetVariable', 'PageFree', PageFree .. ' ' ..s3)	
	
	return
	
end

function AutoScale(num, idp)
	assert(tonumber(num), 'AutoScale expects a number.')
	local scales = {'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'}
	local places = idp or 0
	local scale = ""
	local scaled = 0

	for i, v in ipairs(scales) do
		if (num < (1024 ^ i)) or (i == #scales) then
			scale = v
			scaled = Round(num / 1024 ^ (i - 1), places)
			if scaled % 1 == 0 then
				scaled = scaled .. '.0'
			end
			break
		end
	end

	return scaled, scale
end

function Round(num, idp)
	assert(tonumber(num), 'Round expects a number.')
	local mult = 10 ^ (idp or 0)
	if num >= 0 then
		return math.floor(num * mult + 0.5) / mult
	else
		return math.ceil(num * mult - 0.5) / mult
	end
end
User avatar
Yincognito
Posts: 1152
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Tooltip hot-spot

Post by Yincognito »

jsmorley wrote:
March 15th, 2020, 3:25 pm
Nope, just tabs...

Code: Select all

ToolTipTitle=System Memory
ToolTipType=1
ToolTipIcon=#ImagePath#Ram.ico
ToolTipText=#CRLF#Physical Total	#PhysicalTotal##CRLF#Physical Used	#PhysicalUsed##CRLF#Physical Free	#PhysicalFree##CRLF##CRLF#Swap Total	#SwapTotal##CRLF#Swap Used	#SwapUsed##CRLF#Swap Free	#SwapFree##CRLF##CRLF#Page Total	#PageTotal##CRLF#Page Used	#PageUsed##CRLF#Page Free	#PageFree#
Oh, yes - you're right. These work for left alignment. For right alignment though, using different width spaces is, as far as I know, the only solution when it comes to the feature limited environment of standard tooltips.
User avatar
jsmorley
Developer
Posts: 20457
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Tooltip hot-spot

Post by jsmorley »

Yincognito wrote:
March 15th, 2020, 3:41 pm
Oh, yes - you're right. These work for left alignment. For right alignment though, using different width spaces is, as far as I know, the only solution when it comes to the feature limited environment of standard tooltips.
Yeah, I wasn't going for "right alignment", just "columns".
User avatar
Yincognito
Posts: 1152
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Tooltip hot-spot

Post by Yincognito »

jsmorley wrote:
March 15th, 2020, 3:25 pm
I use some Lua to "autoscale" the values for use in a Tooltip, which doesn't support scaling in TooltipText.

Code: Select all

function Initialize()

	msPhysicalTotal = SKIN:GetMeasure('MeasurePhysMemTotal')
	msPhysicalUsed = SKIN:GetMeasure('MeasurePhysMemUsed')
	msPhysicalFree = SKIN:GetMeasure('MeasurePhysMemFree')
	msSwapTotal = SKIN:GetMeasure('MeasureSwapMemTotal')
	msSwapUsed = SKIN:GetMeasure('MeasureSwapMemUsed')
	msSwapFree = SKIN:GetMeasure('MeasureSwapMemFree')
	msPageTotal = SKIN:GetMeasure('MeasurePageTotal')
	msPageUsed = SKIN:GetMeasure('MeasurePageUsed')
	msPageFree = SKIN:GetMeasure('MeasurePageFree')	
	
end

function Update()

	physicalTotal, s1 = AutoScale(msPhysicalTotal:GetValue(),1)
	physicalUsed, s2 = AutoScale(msPhysicalUsed:GetValue(),1)
	physicalFree, s3 = AutoScale(msPhysicalFree:GetValue(),1)
	SKIN:Bang('!SetVariable', 'PhysicalTotal', physicalTotal .. ' ' ..s1)
	SKIN:Bang('!SetVariable', 'PhysicalUsed', physicalUsed .. ' ' ..s2)
	SKIN:Bang('!SetVariable', 'PhysicalFree', physicalFree .. ' ' ..s3)
	SwapTotal, s1 = AutoScale(msSwapTotal:GetValue(),1)
	SwapUsed, s2 = AutoScale(msSwapUsed:GetValue(),1)
	SwapFree, s3 = AutoScale(msSwapFree:GetValue(),1)
	SKIN:Bang('!SetVariable', 'SwapTotal', SwapTotal .. ' ' ..s1)
	SKIN:Bang('!SetVariable', 'SwapUsed', SwapUsed .. ' ' ..s2)
	SKIN:Bang('!SetVariable', 'SwapFree', SwapFree .. ' ' ..s3)
	PageTotal, s1 = AutoScale(msPageTotal:GetValue(),1)
	PageUsed, s2 = AutoScale(msPageUsed:GetValue(),1)
	PageFree, s3 = AutoScale(msPageFree:GetValue(),1)
	SKIN:Bang('!SetVariable', 'PageTotal', PageTotal .. ' ' ..s1)
	SKIN:Bang('!SetVariable', 'PageUsed', PageUsed .. ' ' ..s2)
	SKIN:Bang('!SetVariable', 'PageFree', PageFree .. ' ' ..s3)	
	
	return
	
end

function AutoScale(num, idp)
	assert(tonumber(num), 'AutoScale expects a number.')
	local scales = {'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'}
	local places = idp or 0
	local scale = ""
	local scaled = 0

	for i, v in ipairs(scales) do
		if (num < (1024 ^ i)) or (i == #scales) then
			scale = v
			scaled = Round(num / 1024 ^ (i - 1), places)
			if scaled % 1 == 0 then
				scaled = scaled .. '.0'
			end
			break
		end
	end

	return scaled, scale
end

function Round(num, idp)
	assert(tonumber(num), 'Round expects a number.')
	local mult = 10 ^ (idp or 0)
	if num >= 0 then
		return math.floor(num * mult + 0.5) / mult
	else
		return math.ceil(num * mult - 0.5) / mult
	end
end
Oh, "manual" autoscaling. :D I use a different method, with the same results (sample below - MS_Rainmeter_NICULRate is the "raw" upload rate value for a network interface, [MS_Rainmeter_ULRate] is the "manually" autoscaled one, and #Decimals1# is the decimal precision desired):

Code: Select all

[MS_Rainmeter_ULRate]
Measure=Calc
Formula=Round(MS_Rainmeter_NICULRate/1024**((MS_Rainmeter_NICULRate<=1?1:Ceil(Log(MS_Rainmeter_NICULRate)/Log(1024)))-1),#Decimals1#)+(MS_Rainmeter_NICULRate<=1?1:Ceil(Log(MS_Rainmeter_NICULRate)/Log(1024)))*(1/(10**(#Decimals1#+2)))
RegExpSubstitute=1
Substitute="^(.*)$":"   \1","^.*(.{4}\..{#Decimals1#}).{1}(.{1}).*$":"\1\2","1$":"  ","2$":" k","3$":" M","4$":" G","5$":" T","6$":" P","7$":" E","8$":" Z","9$":" Y"
It uses the Log() function to do both autoscaling and to add an "autoscale identifier" (basically, just a digit) at the end of the number, the latter of which is then "converted" to k, M, G, etc. in front of the normal suffix of the unit of measurement. Unfortunately, this doesn't work for more than 4 or 5 decimal precision, because the string value of a numeric measure in Rainmeter is limited to 5 (as far as I recall) digits after the decimal separator.
User avatar
Beuwolf
Posts: 28
Joined: February 15th, 2020, 10:08 pm

Re: Tooltip hot-spot

Post by Beuwolf »

jsmorley wrote:
March 15th, 2020, 3:11 pm
Mind you, that's not to say I have not been guilty of over-using tooltips myself... ;-)

1.jpg
Hi jsmorley.

Sorry to ask about something else then the topic of the thread. I tried to search but my google skills don't seem to be up to the task.

In this first picture, your tooltip is showing the Windows Version and Build number (I found what to use to have Rainmeter display what OS I have, i.e. Windows 10 but more interested in Version and Build (unless I missed it there?)). Could you be kind and point me in the right direction to find out how to access that information through a Rainmneter command, please ? I know where to get it on the PC, just would like to have it on one of the gadgets instead. :D

Thank you for any and all assistance and sorry once again to slightly derail the thread ! :oops: