Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 30th Oct 2012 22:24
I've already got a crude scroll bar working. The problem I'm having is that the area the scroll bar is in will constantly change. I have a window inside my program for the scroll bar, so when the window is changed so is the scroll bar. The method I'm currently using involves using memblocks, but I feel that using them is processor heavy although the only time the function is used is when the window size changes, so my question is what is a good method for creating an adjustable scroll bar.

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Oct 2012 23:51
You have some code we could see? What are you displaying in the window that needs scrolling?

"You're not going crazy. You're going sane in a crazy world!" ~Tick
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 31st Oct 2012 02:50

Thats demonstrating whats going on. The scroll bar constantly changes sizes. The code is very sloppy but I can probably rip some if you need it. I was just really wondering if anyone had thought of any good methods for this?

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Oct 2012 02:54 Edited at: 31st Oct 2012 03:02
Have you tried a forum search for scrollbar examples?

Here's one of my snippets
And another

And here's my GUI tutorial covering all sorts of stuff:
http://dbcodecorner.com/?page=tutorials


So I'm guessing you want the scrollbar to resize but according to how much data is in the window?

view = how much you can see in your window
total = how much total data there is to see

Calculate the percent of how much of the content is visible (Between 0.0 and 1.0, you'll want add a check to make sure it doesn't go over 1)
t# = view/total

max = maximum size of your scrollbar (technically called the scrollbar's thumb. The thumb slides along the track) This can be as large as the view size or less.

This is the size of your scrollbar thumb
sbSize = max * t#

Make one last check to make sure your sbSize isn't too small.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 31st Oct 2012 03:12 Edited at: 31st Oct 2012 04:23
don't you have to include the size of the data and if you make a variable global in dbp. will it pass through to functions as well. I see you did that in your code example

Got everything working lightning fast. I'm currently getting 2k+ fps compared to the 35 I was getting. I'm obviously going to regulate the speed but for testing purposes, its nice to know. Thanks for your help Phaelax
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Nov 2012 00:03
If you really want to know what kind of GUI you make in DB, take a look at my old itunes project. All native code, no plugins or images used.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 1st Nov 2012 08:32
I remember when you posted that :p forever ago lol. and I got it working thanks so much for your help phaelax.

Login to post a reply

Server time is: 2026-07-10 18:55:11
Your offset time is: 2026-07-10 18:55:11