It is currently February 16th, 2019, 2:15 am

Limit of the text in ToolTip

Tips and Tricks from the Rainmeter Community
User avatar
~Faradey~
Posts: 367
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Limit of the text in ToolTip

~Faradey~ » November 26th, 2017, 4:53 pm

Some of you may have stumbled upon this question when you have large amount of text in your ToolTip and how Rainmeter is handle it. Well it may not be the only solution but i thought some may found this useful

Using RegexpSubstitute=1 you cant trim text to N number of character to suffice yor needs, i've found that 250 is ok maximum.
In this example i used Variable to store long string, but whole idea in using Regular expression substitute.

1st ToolTip is original text and 2nd is trimmed
click on image to animate
example_trim.gif

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
 ; maximum number of characters to show
NumOfCharacters=210

LongString=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

[StripText]
Measure=STRING
String=#LongString#
RegexpSubstitute=1
Substitute="(.{#NumOfCharacters#}).*":"\1..."

[MeterString_NoStrip]
Meter=String
SolidColor=56BCA4
ToolTipText=#LongString#
ToolTipWidth=350
X=150
Y=40
W=280
H=70
Text="Hover over me"
FontColor=181818
FontFace=Arial
FontSize=10
StringAlign=CENTERCENTER
StringStyle=BOLD
AntiAlias=1

[MeterString_Strip]
Meter=String
MeasureName=StripText
SolidColor=785BBC
ToolTipText=%1
ToolTipWidth=350
X=r
Y=10R
W=280
H=70
Text="Hover over me"
FontColor=181818
FontFace=Arial
FontSize=10
StringAlign=CENTERCENTER
StringStyle=BOLD
AntiAlias=1
You do not have the required permissions to view the files attached to this post.