|
|
| Forums -> Q & A -> Drawing and resizing a table of values |
Kyle
|
Drawing and resizing a table of values |
Posted Nov 09 2009 Hi guys,
I'm interested in having a large table of values - a bit like a spreadsheet. In fact, it basically will be a spreadsheet. This can be done using the LINE command a lot (obviously), but i'm looking for a faster way to:
1. Construct a table with room for lots of values (one value per 'cell')
2. The ability to re-size the table, both column width/height and row width/height, just by entering a value to change the size.
I'm not too sure about how to approach doing this without using a whole bunch of LINE commands, and even then, I wouldn't know how to re-size it using that.
All help appreciated, thanks guys. :) |
Clippy
|
What do the lines have to do with the table values? |
Posted Nov 09 2009 An Array can hold 2 or more dimensions of values. Whatever "values" means to you. |
Kyle
|
|
Posted Nov 09 2009 I think you've misunderstood what i'm trying to do. I want to visually construct a table, not how to actually store data. |
Clippy
|
You do not need to have a bunch of line statements. |
Posted Nov 10 2009 First calculate the number of lines needed in each direction, keeping in mind the pixel dimension limits of a SCREEN mode.
Then use a loop with one LINE statement for each direction. |
Kyle
|
Thanks, but how would I do that? |
Posted Nov 10 2009 Thanks for the info, that sounds like a good way to do it - it'll save me a whole lot of LINE statements, but can you provide some sort of code example on how to work it all out? SCREEN 12 is the screen which I'll be using throughout the program. |
Clippy
|
Screen 12 is 640 by 480 pixels max |
Posted Nov 11 2009 So you would need to calculate the space between each line for the number of lines desired. Since the spacing may be a decimal point value like 1.5 I would add 1.5 each loop. Decimal values will round up or down like CINT in graphics coordinates. You cannot use 1/2 of a pixel!
For columns use: columnspace = 640/numberofcolumns.
Rows use: rowspace = 480/numberofrows |