It is currently May 25th, 2019, 2:21 pm

Scrolling Text in a Container

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Scrolling Text in a Container

jsmorley » February 23rd, 2019, 3:04 pm

CaseyScroll_1.1.rmskin


Click to animate
GIF.gif


CaseyScroll.ini:

Code: Select all

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

[Variables]
LeastY=13
CurrentY=13
; This FontHeight is the height in pixels of a character in 
; the font, inlcuding any slack space above or below the actual
; character glyph.
FontHeight=17

[MeasureFile]
Measure=WebParser
; The file should be encoded as UTF-8 or ANSI. If you need to use a
; file that is encoded as UTF-16 LE, Set CodePage=1200 on this measure.
URL=file://#@#Text\Casey at the bat.txt
;URL=file://#@#Text\Charge of the Light Bridage.txt
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!UpdateMeter MeasureTextHeight]

[MeterHider]
Meter=Shape
; So we don't want [MeasureTextHeight] to impact the height of the
; overall skin, nor to in any way be actually displayed, so we put
; it inside a Container that is a "singularity". It will still have
; the measureable width and height that it would on its own, but will
; not display, nor make the size of the skin any larger.
X=-1
Y=-1
W=1
H=1
SolidColor=0,0,0,1

[MeasureTextHeight]
Meter=String
; We use this to measure the height of the text as if it was displayed,
; by using [MeasureTextHeight:H] in a formula anywhere.
MeasureName=MeasureFile
W=483
ClipString=2
FontSize=11
FontColor=0,0,0,0
Container=MeterHider

[MeterContainerVisible]
Meter=Shape
Shape=Rectangle 1,1,483,303 | StrokeWidth 2 | Stroke Color 150,150,150,255 | Fill Color 47,47,47,255

[MeterContainer]
Meter=Shape
; Note that we don't want any text to overlap the border "stroke" on the 
; visible container, so we make the actual container a tad inset and smaller.
Shape=Rectangle 2,2,480,300
DynamicVariables=1
MouseScrollDownAction=[!SetVariable CurrentY "(Clamp((#CurrentY# - (#FontHeight#*2)),(-([&MeasureTextHeight:H]-300)),#LeastY#))"][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetVariable CurrentY "(Clamp((#CurrentY# + (#FontHeight#*2)),(-([&MeasureTextHeight:H]-300)),#LeastY#))"][!UpdateMeter *][!Redraw]

[MeterText]
Meter=String
MeasureName=MeasureFile
Y=#CurrentY#
W=483
ClipString=2
FontSize=11
FontWeight=400
FontColor=255,255,255,255
Padding=10,0,0,0
AntiAlias=1
DynamicVariables=1
Container=MeterContainer
You do not have the required permissions to view the files attached to this post.