how do i do a scrollbar like in explorer

Started by Joseph, Fri 11/02/2011 03:39:39

Previous topic - Next topic

Joseph

heeeyah!! ;D

dear kind sirs/and or wenches/turtles;

how can  i make scrollbar for inventory  that the slider change size depending on the amount of items in my inventory window? just like in expolrer, notice if a folder has many items the slider bar is smaller...but if its almost empty is huge! when i drag the scrollbar slider it also scrolls up or down the rows by row.???
is this doable ???
Spread the love...One.Turtle.At.A.Time.
http://www.youtube.com/watch?v=y0A77rohcyg

Khris

This is doable, yes. Just use a GUI Slider and change its size and the size of the handle accordingly.

Say the scrollbar can show 6 items and there's 10 in your inventory, then the slider handle needs to be 6/10 times the width of the inventory window.
To set it up so the slider handle will line up nicely with the edge of the inv window, the slider needs to be (inv window width - handle width) wide/high and centered.
Basically, use on_event and every time the player gains or loses inventory, update the position, width and handle image of the slider.
For starters, use a global DynamicSprite for the handle image and draw a rectangle on it.

As for the slider values I'd use 1 to 100 for smooth scrolling and change InvWindow.TopItem accordingly. Takes a bit of math, too.

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Joseph

OOOOOOhhhhhh!! i got it to do it like i wanted with this help exept changing the handle sprite (gonna do later). a great thank-you to both kind sirs! :=

Cheers/doy las gracias/Merci   :D ;D :-*
Spread the love...One.Turtle.At.A.Time.
http://www.youtube.com/watch?v=y0A77rohcyg

SMF spam blocked by CleanTalk