3 posts
Posted 06 November 2012 - 02:51 PM
I have a computer that controls an elevator. I will have multiple computers. I have a 40 floor building and my menu needs to have 40 options to choose from. Once I add an 18th option the 1st option moves off page as if there isn't room. The page now starts with option number 2 instead of 1. I would like for it to add options below so option 18 would be off the page below option 17 (bottom of the page) and be able to scroll down from 17 to extend the page and see option 18 and so on until I get to 40. If this is not possible, is there a way I could create sub menus, for example I would have 8 options, each with 5 floors in each. Option 1 would have floors 1-5, option 2 would have floors 6-10, option 3 would have 11-15, option 4 would have 16-20, option 5 would have 20-25, option 6 would have 26-30, option 7 would have 31-35, and option 8 would have 30-35. Once you an option from 1-8, you would see those 5 floors in that option such as option one offering the ability to select floors 1-5 to travel to. Currently you just select the floor you want to travel to and it takes you there. If I cannot do this by extending the page downwards I would like to have sub menus. My code is here for my menu (not including the code for travel programs for each floor):
http://pastebin.com/0jV2RMh8
767 posts
Posted 06 November 2012 - 07:19 PM
First of all. Use tables , then you can delete and put more into it everytime.
there is a Nice menu tutorial with tables, in the tutorials section, that would be good for this.
818 posts
Posted 06 November 2012 - 07:22 PM
I would say waiting for a right/left key press to switch between menus is your best bet here. but sure, if you really want, scrolling is an option to, though it is much harder
btw:
term.setCursorPos(x,y)
print("[")
term.setCursorPos(z,y)
print("]")
should be:
term.setCursorPos(x,y)
write("[")
term.setCursorPos(z,y)
write("]")
3 posts
Posted 07 November 2012 - 02:59 AM
Why should I use write instead of print for
term.setCursorPos(x,y)
print("[")
term.setCursorPos(z,y)
print("]")
May you please link me to this tutorial as well. Will tables allow all of it to be accessible like I want?
Also how would you add scrolling?
818 posts
Posted 07 November 2012 - 10:37 AM
because print ends with a CR(pretty much makes a new line after)
8543 posts
Posted 07 November 2012 - 11:13 AM
because print ends with a CR(pretty much makes a new line after)
Technically, it appends a newline special character. The actual character or character combination that newline represents is system-dependent.
818 posts
Posted 07 November 2012 - 11:20 AM
yeah it really ends with a n, but I ment that it will stimulate a "enter" keypress
3 posts
Posted 07 November 2012 - 12:19 PM
So by changing it to write from print it would work just as before, just the code would be more correct? I haven't noticed anything wrong with it so this would just prevent any future problems? What could I add to my code to make my text have a scroll ability and so that when I add new lines it won't push my text up but rather down. Currently whenever I add a new line it pushes all the older lines up 1 making the ones that were pushed beyond line 1 unreachable. Is there a way I can make it do the opposite and have it push the new lines down so that it could be scrolled through from top to bottom, in ascending floor order (Floor 1 (top)- Floor 40(bottom)) having the whole page filled with floor levels and I would just have to scroll down to see the ones that go beyond the page (floors 18 and beyond)?
The attached picture shows what it does to the new floors and the old floors (pushes the first floor option off the page)
1548 posts
Location
That dark shadow under your bed...
Posted 27 November 2012 - 11:09 AM
hey scopz. I am leaving now so cannot type out a long explanation however I would like to help so here[
1][
2][
3] are links to three of my menu functions which both have scrolling functionality. take a look at them and see if you can decypher my messy coding :)/>
PS: they are ordered by complexity, the first one should be easy enough to understand, the others incorporate other things (multiple columns and mouse functionality) that increase complexity