|
Post by jarychk on Jul 8, 2022 11:14:57 GMT
NOT UNDERSTAND WHY WRITING ARRAYS TO TEXT WINDOW USING SPACE$() FAILS
The "identified" bad line is the print to the text window in the loop, print #players,pianoplayers$(i0,1);space$(19-len(pianoplayers$(i0,1));pianoplayers$(i0,2) . I see no syntax error. I just trying to give 19 character size for the first column, and to use space$() to accomodate formatting the place the second array element column.
The file being used is a few rows of three elements in each row.
' file to show is pianoplayers.txt
dim pianoplayers$(20,4) 'second dimension is 4, just so I am sure I have enough 'PROCESS VARBS
name$=""
bwhere$=""
byear$=""
rec=0
open "pianoplayers.txt" for input as #pla
while eof(#pla)=0
input #pla,name$
input #pla,bwhere$
input #pla,byear$
rec=rec+1
pianoplayers$(rec,1)=name$
pianoplayers$(rec,2)=bwhere$
pianoplayers$(rec,3)=byear$
wend
close #pla
WindowWidth = 744
WindowHeight = 470
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
open "show the players and data of each" for text as #players
print #players, "!trapclose [quit.players]"
print #players, "!font ms_sans_serif 10"
'first column should occupy 19 places
print #players,"This is the data of the ";rec;" found players."
for i0=1 to rec
dummy=0
print #players,pianoplayers$(i0,1);space$(19-len(pianoplayers$(i0,1));pianoplayers$(i0,2)
next i0
WAIT
[quit.players]
close #players
'wait
END
|
|
|
Post by tsh73 on Jul 8, 2022 20:49:28 GMT
If you use any text editor with matching braces support (in my case it is old version of Notepad++) you will see that you have one ')' missing, so space$ has no closing brace.
|
|
|
Post by jarychk on Jul 8, 2022 22:20:27 GMT
If you use any text editor with matching braces support (in my case it is old version of Notepad++) you will see that you have one ')' missing, so space$ has no closing brace. Very fine! I really should have actually tried COUNTING the parentheses. I tried only 'looking', which often not good enough. Next problem in this study may be the distinction between these groups of font forms: Can you tell me or explain these two groups? and
|
|
|
Post by jarychk on Jul 8, 2022 22:57:50 GMT
NOW I see, the first grouping of named fonts not the same because the second named group of fonts are all Fixed-Width fonts. These will give the better spacings that I want.
EDIT: No. Those groupings are wrong! I just tried testing the program using fonts of both groups. The only one which gives the desired alignment is "courier". None of the others seem to give the desired neat columnar alignment.
|
|