Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1065

Community Tips & Tricks • ScrollBar Template

$
0
0
I'd like to share this ScrollBar Template for future reference.

The thumbs resize according to the content, they also hide when the content is shorter than the container.

The template can be resized by dragging, however this is not mandatory and can be deleted from the code if not necessary.

The thumbs can't be dragged with the mouse, I didn't include that functionality as it requires some formula I don't remember right now. I'm pretty tired, a family member past away this weekend and I have no brain for that right now. I wanted to share it anyway. However, if anyone is kind enough to add the mouse dragging would be awesome.

Scroll.gif

Package:
ScrollBarTemplate_1.0.rmskin

Code: (Requires the Mouse Plugin for dragging functionality, which is included on the package above.)

Code:

[Rainmeter]Update=1000AccurateText=1[Metadata]Name=ScrollBarAuthor=RicardoTMInformation=A functional scrollbar templateVersion=1.0License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0[Variables]Text=The Charge of the Light Brigade#CRLF#by Alfred, Lord Tennyson#CRLF##CRLF#Half a league, half a league,#CRLF#Half a league onward,#CRLF#All in the valley of Death#CRLF#Rode the six hundred.#CRLF#Forward, the Light Brigade!#CRLF#Charge for the guns! he said:#CRLF#Into the valley of Death#CRLF#Rode the six hundred.#CRLF##CRLF#Forward, the Light Brigade!#CRLF#Was there a man dismayed?#CRLF#Not though the soldier knew#CRLF#Some one had blundered:#CRLF#Their's not to make reply,#CRLF#Their's not to reason why,#CRLF#Their's but to do and die:#CRLF#Into the valley of Death#CRLF#Rode the six hundred.#CRLF##CRLF#Cannon to right of them,#CRLF#Cannon to left of them,#CRLF#Cannon in front of them#CRLF#Volleyed and thundered;#CRLF#Stormed at with shot and shell,#CRLF#Boldly they rode and well,#CRLF#Into the jaws of Death,#CRLF#Into the mouth of Hell#CRLF#Rode the six hundred.#CRLF##CRLF#Flashed all their sabres bare,#CRLF#Flashed as they tuned in air#CRLF#Sabring the gunners there,#CRLF#Charging an army, while#CRLF#All the world wondered:#CRLF#Plunged in the battery-smoke#CRLF#Right through the line they broke;#CRLF#Cossack and Russian#CRLF#Reeled from the sabre-stroke#CRLF#Shattered and sundered.#CRLF#Then they rode back, but not#CRLF#Not the six hundred.#CRLF##CRLF#Cannon to right of them,#CRLF#Cannon to left of them,#CRLF#Cannon behind them#CRLF#Volleyed and thundered;#CRLF#Stormed at with shot and shell,#CRLF#While horse and hero fell,#CRLF#They that had fought so well#CRLF#Came through the jaws of Death,#CRLF#Back from the mouth of Hell,#CRLF#All that was left of them,#CRLF#Left of six hundred.#CRLF##CRLF#When can their glory fade?#CRLF#Oh the wild charge they made!#CRLF#All the world wondered.#CRLF#Honour the charge they made!#CRLF#Honour the Light Brigade,#CRLF#Noble six hundred!;SkinWidth=212Height=180Margin=10MinWidth=100MaxWidth=1000MinHeight=100MaxHeight=1000;ScrollingScrollY=0ScrollX=0ScrollSteps=10;ContainerContWidth=([#*Width*]-#Margin#*2-([&*Content:H*]<=[&*Container:H*]?0:[#*SBYWidth*]))ContHeight=([#*Height*]-#Margin#*2-([&*Content:W*]<=[&*Container:W*]?0:[#*SBXHeight*]));ScrollBarsSBYWidth=10SBYHeight=#ContHeight#SBXWidth=#ContWidth#SBXHeight=10SBCorners=(#SBYWidth#/2);ScrollThumbsThumbYWidth=#SBYWidth#ThumbYHeight=(Clamp(Floor(Clamp([&*Container:H*]/([&*Content:H*]+0.000001),0,1)*[&*Container:H*]),(#ThumbYWidth#*3),[&*Container:H*]))ThumbY=(Clamp([#*ScrollY*] / ([&*Content:H*] - [&*Container:H*] + 0.000001), 0, 1)*([&*Container:H*]-[#*ThumbYHeight*]))ThumbXHeight=#SBXHeight#ThumbXWidth=(Clamp(Floor(Clamp([&*Container:W*]/([&*Content:W*]+0.000001),0,1)*[&*Container:W*]),(#ThumbXHeight#*3),[&*Container:W*]))ThumbX=(Clamp([#*ScrollX*] / ([&*Content:W*] - [&*Container:W*] + 0.000001), 0, 1)*([&*Container:W*]-[#*ThumbXWidth*]));ColorBGColor=0,0,0,200SBColor=75,75,75STColor=125,125,125;================;= MEASURES=;================[MouseXY]Disabled=1Group=MouseMeasure=PluginPlugin=MouseLeftMouseDragAction=[!SetVariable Width "(clamp($MouseX$,#MinWidth#,#MaxWidth#))"][!SetVariable Height "(clamp($MouseY$,#MinHeight#,#MaxHeight#))"][!Update]LeftMouseUpAction=[!CommandMeasure MouseXY "Stop"][!WriteKeyValue Variables Width [#Width]][!WriteKeyValue Variables Height [#Height] ][!DisableMeasureGroup Mouse]RequireDragging=1DynamicVariables=1[MouseX]Disabled=1Group=MouseMeasure=PluginPlugin=MouseLeftMouseDragAction=[!SetVariable Width "(clamp($MouseX$,#MinWidth#,#MaxWidth#))"][!Update]LeftMouseUpAction=[!CommandMeasure MouseX "Stop"][!WriteKeyValue Variables Width [#Width]][!DisableMeasureGroup Mouse]RequireDragging=1DynamicVariables=1[MouseY]Disabled=1Group=MouseMeasure=PluginPlugin=MouseLeftMouseDragAction=[!SetVariable Height "(clamp($MouseY$,#MinHeight#,#MaxHeight#))"][!Update]LeftMouseUpAction=[!CommandMeasure MouseY "Stop"][!WriteKeyValue Variables Height [#Height]][!DisableMeasureGroup Mouse]RequireDragging=1DynamicVariables=1;============;=METERS=;============[Background]Meter=ImageW=#Width#H=#Height#SolidColor=#BGColor#DynamicVariables=1[Container]Meter=ImageW=#ContWidth#X=#Margin#Y=#Margin#H=(#ContHeight#)SolidColor=0,0,0DynamicVariables=1MouseScrollUpAction=[!SetVariable ScrollY "(Clamp(#ScrollY# - #ScrollSteps#, 0, Max(-([Container:H] - [Content:H]), 0)))"][!Update]MouseScrollDownAction=[!SetVariable ScrollY "(Clamp(#ScrollY# + #ScrollSteps#, 0, Max(-([Container:H] - [Content:H]), 0)))"][!Update][Content]Meter=StringContainer=ContainerStringAlign=LeftX=(Clamp(Max(([Container:W] - [Content:W]), 0) - #ScrollX#, Min(([Container:W] - [Content:W]), 0), 0))Y=(Clamp(Max(([Container:H] - [Content:H]), 0) - #ScrollY#, Min(([Container:H] - [Content:H]), 0), 0))FontSize=9AntiAlias=1Text=#Text#FontColor=255,255,255SolidColor=0,0,0,1DynamicVariables=1[ScrollBarY]Hidden=([Content:H]<=[Container:H]?1:0)Meter=ShapeShape=Rectangle ([Container:W]+#Margin#),[Container:Y],#SBYWidth#,#SBYHeight#,#SBCorners# | StrokeWidth 0 | Fill Color #SBColor#DynamicVariables=1MouseScrollUpAction=[!SetVariable ScrollY "(Clamp(#ScrollY# - #ScrollSteps#, 0, Max(-([Container:H] - [Content:H]), 0)))"][!Update]MouseScrollDownAction=[!SetVariable ScrollY "(Clamp(#ScrollY# + #ScrollSteps#, 0, Max(-([Container:H] - [Content:H]), 0)))"][!Update][ThumbY]Meter=ShapeMeterStyle=ScrollBarYShape=Rectangle ([Container:W]+#Margin#),([Container:Y]+#ThumbY#),#SBYWidth#,#ThumbYHeight#,#SBCorners# | StrokeWidth 0 | Fill Color #STColor#[ScrollBarX]Hidden=([Content:W]<=[Container:W]?1:0)Meter=ShapeShape=Rectangle ([Container:X]),([Container:H]+#Margin#),#SBXWidth#,#SBXHeight#,#SBCorners# | StrokeWidth 0 | Fill Color #SBColor#DynamicVariables=1MouseScrollUpAction=[!SetVariable ScrollX "(Clamp(#ScrollX# - #ScrollSteps#, 0, Max(-([Container:W] - [Content:W]), 0)))"][!Update]MouseScrollDownAction=[!SetVariable ScrollX "(Clamp(#ScrollX# + #ScrollSteps#, 0, Max(-([Container:W] - [Content:W]), 0)))"][!Update][ThumbX]Meter=ShapeMeterStyle=ScrollBarXShape=Rectangle ([Container:X]+#ThumbX#),([Container:H]+#Margin#),#ThumbXWidth#,#SBXHeight#,#SBCorners# | StrokeWidth 0 | Fill Color #STColor#[DraggerNWSE]Group=DraggerMeter=ImageSolidColor=255,0,0,1W=#Margin#H=#Margin#X=(#Width#-#Margin#)Y=(#Height#-#Margin#)LeftMouseDownAction=[!EnableMeasureGroup Mouse][!CommandMeasure MouseXY "Start"] MouseActionCursorName=SIZE_NWSEDynamicVariables=1[DraggerE]Meter=ImageMeterStyle=DraggerNWSEH=(#Height#-#Margin#*2)Y=(#Margin#)LeftMouseDownAction=[!EnableMeasureGroup Mouse][!CommandMeasure MouseX "Start"] MouseActionCursorName=SIZE_WE[DraggerS]Meter=ImageMeterStyle=DraggerNWSEW=(#Width#-#Margin#*2)X=(#Margin#)LeftMouseDownAction=[!EnableMeasureGroup Mouse][!CommandMeasure MouseY "Start"] MouseActionCursorName=SIZE_NS
Pd. I only used [!Update] bangs for simplicity.

Statistics: Posted by RicardoTM — Yesterday, 11:11 pm



Viewing all articles
Browse latest Browse all 1065

Trending Articles