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.

DarkBASIC Discussion / Scrollbar

Author
Message
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 5th Aug 2003 10:18 Edited at: 5th Aug 2003 10:20
I'm making a lil game, it'll be in 2D. And Sometimes, people have to select objects from a list (here : food).
I got the list in a file, and the file is readable with the instructions below :



number is the number of food-items
aliment$ is the food-name-item
nombre is the number of calories of this food

But my problem was here : number became to big, so all food-items couldn't be displayed anymore on the screen. That's why I'm asking how I could make some kind of scrollbar.
(Rem - there will be a bitmap on the background, so it shouldn't delete what's behind it)

"Begin at the beginning, and go on till you come to the end: then stop." - Lewis Carroll
Lecks
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: - Please Select -
Posted: 5th Aug 2003 11:59
to make a good scrollbar (that you use with the mouse) would be quite difficult i would imagine. i can try and help you get the idea though .


let me know if it works good luck.

Beavis
22
Years of Service
User Offline
Joined: 15th May 2003
Location: Czech Republic
Posted: 5th Aug 2003 12:02
Load items into array and keep index of display and display only exact number of items. Whe user click on scrollbar then change index and redraw output.
Beavis
22
Years of Service
User Offline
Joined: 15th May 2003
Location: Czech Republic
Posted: 5th Aug 2003 12:03
Ahhh... Lecks was quicker.
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 5th Aug 2003 13:15
Thanks for the reply, but it isn't working fine ... It goes out of the array-dimension, and it isn't displaying the items, like it should.
You can see for yourself, I got one of the data-files on the following page :
http://membres.lycos.fr/afnee/show.html
You can try it with my code , then with Lecks' one. I tried to search for the problem, but didn't really find a way to fix it.
(Rem - I'm using DBC)

"Begin at the beginning, and go on till you come to the end: then stop." - Lewis Carroll
Lecks
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: - Please Select -
Posted: 5th Aug 2003 13:57

i nearly got it . yay, i can program in french!

Lecks
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: - Please Select -
Posted: 5th Aug 2003 13:59
ps. the reason it wasnt working is because the list size was less than numbertodisplay, and i used read float instead of read word.

Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 5th Aug 2003 19:12
Great ! That worked :
But the last item wasn't displayed. And once you left the first one, you couldn't see him again, so I changed the code lightly into that :



As you see, I also added a lil thing : when you come at the end of the list, the beginning will be displayed under it. (and the end, would be displayed before the beginning, if you scroll up too much.

Erm ... yeah ... sorry for the french comments, but believe me, it's worse here : I have the German version of DB, so all error-messages are in German

"Begin at the beginning, and go on till you come to the end: then stop." - Lewis Carroll
Lecks
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: - Please Select -
Posted: 5th Aug 2003 19:29
heh i dont care, i didnt even know what language it was

Login to post a reply

Server time is: 2025-05-20 01:53:13
Your offset time is: 2025-05-20 01:53:13