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

Community Tips & Tricks • Re: ScrollBar Template

$
0
0
Just got home from work and had some time to make an example with multiple meters.

The Code is mostly the same, I did what I mentioned above, plus added all variables on "Content" on variables section.

You may also check the X and Y options on Meter1 and on Content MeterStyle.

It only scrolls on Y, since I decided to make their Width equal to the container, that means the X scroll bar will always be hidden. However if you want to you can change it on MetersW variable.

You can also add or take away meters, simply change the nMeters variable, the scroller will only scroll up to that amount of meters (however they will still be visible if you make the skin bigger, so you better delete the meters you don't need.)
sdsd.gif

Code:

[Rainmeter]Update=1000AccurateText=1[Metadata]Name=SBMultipleMetersAuthor=RicardoTMInformation=A functional scrollbar template with multiple meters.Version=1.0License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0[Variables];SkinWidth=140Height=144Margin=10MinWidth=100MaxWidth=1000MinHeight=100MaxHeight=1000;ContentnMeters=20MetersW=[Container:W]MetersH=40MetersSpace=2ContentH=([Meter1:H]*#nMeters#+#MetersSpace#*(#nMeters#-1))ContentW=([Meter1:W]);ScrollingScrollY=0ScrollX=0ScrollSteps=(#MetersH#+#MetersSpace#);ContainerContWidth=([#*Width*]-#Margin#*2-([#*ContentH*]<=[&*Container:H*]?0:[#*SBYWidth*]))ContHeight=([#*Height*]-#Margin#*2-([#*ContentW*]<=[&*Container:W*]?0:[#*SBXHeight*]));ScrollBarsSBYWidth=10SBYHeight=#ContHeight#SBXWidth=#ContWidth#SBXHeight=10SBCorners=0;ScrollThumbsThumbYWidth=#SBYWidth#ThumbYHeight=(Clamp(Floor(Clamp([&*Container:H*]/([#*ContentH*]+0.000001),0,1)*[&*Container:H*]),(#ThumbYWidth#*3),[&*Container:H*]))ThumbY=(Clamp([#*ScrollY*] / ([#*ContentH*] - [&*Container:H*] + 0.000001), 0, 1)*([&*Container:H*]-[#*ThumbYHeight*]))ThumbXHeight=#SBXHeight#ThumbXWidth=(Clamp(Floor(Clamp([&*Container:W*]/([#*ContentW*]+0.000001),0,1)*[&*Container:W*]),(#ThumbXHeight#*3),[&*Container:W*]))ThumbX=(Clamp([#*ScrollX*] / ([#*ContentW*] - [&*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] - [#ContentH]), 0)))"][!Update]MouseScrollDownAction=[!SetVariable ScrollY "(Clamp(#ScrollY# + #ScrollSteps#, 0, Max(-([Container:H] - [#ContentH]), 0)))"][!Update][Content]Container=ContainerStringAlign=CenterCenterX=rY=#MetersSpace#RW=#MetersW#H=#MetersH#FontSize=9AntiAlias=1FontColor=255,255,255SolidColor=35,35,35DynamicVariables=1Text=#CURRENTSECTION#MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor 55,55,55][!UpdateMeter #CURRENTSECTION#][!Redraw]MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor ""][!UpdateMeter #CURRENTSECTION#][!Redraw][ScrollBarY]Hidden=([#ContentH]<=[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] - [#ContentH]), 0)))"][!Update]MouseScrollDownAction=[!SetVariable ScrollY "(Clamp(#ScrollY# + #ScrollSteps#, 0, Max(-([Container:H] - [#ContentH]), 0)))"][!Update][ThumbY]Meter=ShapeMeterStyle=ScrollBarYShape=Rectangle ([Container:W]+#Margin#),([Container:Y]+#ThumbY#),#SBYWidth#,#ThumbYHeight#,#SBCorners# | StrokeWidth 0 | Fill Color #STColor#[ScrollBarX]Hidden=([#ContentW]<=[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] - [#ContentW]), 0)))"][!Update]MouseScrollDownAction=[!SetVariable ScrollX "(Clamp(#ScrollX# + #ScrollSteps#, 0, Max(-([Container:W] - [#ContentW]), 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[Meter1]Meter=StringMeterStyle=ContentY=([#CURRENTSECTION#:H]/2+Clamp(Max(([Container:H] - [#ContentH]), 0) - #ScrollY#, Min(([Container:H] - [#ContentH]), 0), 0))X=([#CURRENTSECTION#:W]/2+Clamp(Max(([Container:W] - [#ContentW]), 0) - #ScrollX#, Min(([Container:W] - [#ContentW]), 0), 0))[Meter2]Meter=StringMeterStyle=Content[Meter3]Meter=StringMeterStyle=Content[Meter4]Meter=StringMeterStyle=Content[Meter5]Meter=StringMeterStyle=Content[Meter6]Meter=StringMeterStyle=Content[Meter7]Meter=StringMeterStyle=Content[Meter8]Meter=StringMeterStyle=Content[Meter9]Meter=StringMeterStyle=Content[Meter10]Meter=StringMeterStyle=Content[Meter11]Meter=StringMeterStyle=Content[Meter12]Meter=StringMeterStyle=Content[Meter13]Meter=StringMeterStyle=Content[Meter14]Meter=StringMeterStyle=Content[Meter15]Meter=StringMeterStyle=Content[Meter16]Meter=StringMeterStyle=Content[Meter17]Meter=StringMeterStyle=Content[Meter18]Meter=StringMeterStyle=Content[Meter19]Meter=StringMeterStyle=Content[Meter20]Meter=StringMeterStyle=Content

Statistics: Posted by RicardoTM — Today, 1:48 am



Viewing all articles
Browse latest Browse all 1044

Trending Articles