Terminal Usage
|
09-01-2015, 04:52 PM
Post: #1
|
|||
|
|||
Terminal Usage
Is there any way to determine the current column an item is being printed in? I need a TAB function in my programs to align output. Example;
PRINT(A+TAB(20)+B); Variable B would always print starting in column 20 no matter how large or small A was. I don't see any way to do something like that. If there was a function such as LLOC() that gave the current position of the cursor, I could do this: Code:
If A was two characters long, TAB(20) would return a string of 18 blanks. If A was 5 characters long, TAB(20) would return 15 blanks. You get the idea. Tom L Cui bono? |
|||
09-01-2015, 06:35 PM
(This post was last modified: 09-01-2015 06:36 PM by eried.)
Post: #2
|
|||
|
|||
RE: Terminal Usage
Since the font in the terminal for any number has the same width per number, and each number is 2 spaces wide, why don't you pass the first number to that function?
Example: Code: spaces (var,len) You could optimize that but is an idea. My website: ried.cl |
|||
09-02-2015, 05:57 PM
Post: #3
|
|||
|
|||
RE: Terminal Usage
(09-01-2015 06:35 PM)eried Wrote: Since the font in the terminal for any number has the same width per number, and each number is 2 spaces wide, why don't you pass the first number to that function? Thanks a lot! I still have the problem of minus signs and decimal points (one space instead of two) messing up the columns but it's a lot better than it was. I still wish for a real TAB function, though, where TAB(10) would always start printing in column 10 no matter what had been printed before. LOCATE(X,Y) to start printing at a given column and row would also be handy. Especially if you had a way to determine what row and column you were on to begin with. Tom L Cui bono? |
|||
09-02-2015, 06:47 PM
(This post was last modified: 09-02-2015 06:52 PM by eried.)
Post: #4
|
|||
|
|||
RE: Terminal Usage
Terminal is just an line/output you could create a whole complete UI drawing each text in the display where you want, check:
Code: Syntax: TEXTOUT_P(text, [G], x, y, [font], [textColor], [width], [backgroundColor]) Code: Syntax: BLIT_P([trgtG], [dx1, dy1], [dx2, dy2], srcG, [sx1, sy1], [sx2, sy2], [c]) My website: ried.cl |
|||
09-03-2015, 12:29 PM
(This post was last modified: 09-03-2015 12:34 PM by toml_12953.)
Post: #5
|
|||
|
|||
RE: Terminal Usage
Thanks to eried, I created this simple LOCATE function. It only uses the default font.
Code: EXPORT LOCATE(TEXT,X,Y) Both X and Y start at 1 and (1,1) is the upper left corner of the display. 19 lines fit on the display. Here's a calling program: Code: EXPORT LOCTEST() Thanks again, eried! Tom L Tom L Cui bono? |
|||
09-03-2015, 12:55 PM
Post: #6
|
|||
|
|||
RE: Terminal Usage
Notice that _P means "pixels", so TEXTOUT_P will use pixel positions, and TEXTOUT will use coordinates (these could change)
My website: ried.cl |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)