Computer Science Canada How to make a scroll bar actually work like a scroll bar |
Author: | efan41 [ Fri Dec 04, 2009 2:25 pm ] |
Post subject: | How to make a scroll bar actually work like a scroll bar |
What is it you are trying to achieve? I'm trying to make a scroll bar that the user can use to see up and down the screen What is the problem you are having? I know how to make the scroll bar, I just don't know how exactly I need to write the code to make the scroll bar reveal the top or bottom of the screen. Describe what you have tried to solve this problem I asked my teacher but she isn't familiar with GUI.CreateVerticalScrollBar, tried finding a tutorial on this site but couldn't find one Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) All I have for code is the scroll bar Please specify what version of Turing you are using 4.0.5 or 4.0.1, depending if I'm at school or at home |
Author: | mirhagk [ Sat Dec 05, 2009 9:11 pm ] |
Post subject: | RE:How to make a scroll bar actually work like a scroll bar |
create a two variables var screenx,screeny:=0 now anywhere you draw something do this drawfilloval(500-screenx,50-screeny,5,5,black) or w/e the commands are, just subtract the screenx and screeny now if the user moves the scroll bar up then subtract from the screeny and if the user moves it down, add to the screeny and etc. |
Author: | efan41 [ Tue Dec 08, 2009 2:01 pm ] |
Post subject: | Re: How to make a scroll bar actually work like a scroll bar |
So you're saying I should draw a box that starts at the top of the screen and every time the user clicks on the down arrow, the box draws down by one row ect..? |
Author: | mirhagk [ Tue Dec 08, 2009 2:26 pm ] |
Post subject: | RE:How to make a scroll bar actually work like a scroll bar |
well basically yeah. if the original co-ordinates are something like 50,50 and the user scrolls down by 100 then the box would draw at 50,-50 (so would be off screen and not drawn) |
Author: | efan41 [ Fri Dec 11, 2009 2:25 pm ] |
Post subject: | Re: How to make a scroll bar actually work like a scroll bar |
ok that would work for scrolling down, but how would I make the text re-appear when I scroll up if a box is drawn overtope of it? ex: __________________________________________________________________________________________________ Microsoft Word --Document1 _ X __________________________________________________________________________________________________ hello world, how are you ___________________________________________________________________________________________________ If I had that as a screen, and I used a draw fill box to scroll down, I would get this: __________________________________________________________________________________________________ Microsoft Word --Document1 _ X __________________________________________________________________________________________________ ___________________________________________________________________________________________________ Now how would I be able to recuperate what is under that box when I scroll up? I can't imagine I can undo it, so... |
Author: | Zren [ Fri Dec 11, 2009 2:42 pm ] |
Post subject: | RE:How to make a scroll bar actually work like a scroll bar |
If you'r using just put statements, you could just try View.Set("text") and use the built in scrollbar. |
Author: | efan41 [ Mon Dec 14, 2009 2:27 pm ] |
Post subject: | Re: How to make a scroll bar actually work like a scroll bar |
Well I can't because if I do, it won't let me use a GUI.CreateMenu fonction. I'd find a way around it if I had time, but the projects due this friday, and I have more than just this scroll bar to finish. |
Author: | mirhagk [ Mon Dec 14, 2009 2:53 pm ] |
Post subject: | RE:How to make a scroll bar actually work like a scroll bar |
you'd have to redraw the text every frame in order to get a scroll bar to work, well unless you were super tricky |
Author: | efan41 [ Tue Dec 15, 2009 3:03 pm ] |
Post subject: | Re: How to make a scroll bar actually work like a scroll bar |
So if I were to say have something like: if random_variable_for_counting = 0 then put text drawfillbox (.....) elsif random_variable_for_counting = 1 then put text Where if random_variable_for_counting was equal to 0 then the scroll bar would be going down, and if it were equal to one it would be going up. I'd still have to find a way to make it so it just dosen't go straight to the bottom of a page, and then straight back up again, you know? Plus, if there's enough text to cover the whole page, if I scrolled back up, the put text would give me the lower portion of the text, seeing as it's what was inserted last into the variables memory. btw, text is a flexible array lol. |
Author: | mirhagk [ Tue Dec 15, 2009 3:19 pm ] |
Post subject: | RE:How to make a scroll bar actually work like a scroll bar |
i think your getting confused. By the way Text.LocateXY(x,y:int) lets you start drawing the text at the specified x or y position |