[Gambas-user] COBOL and how great it was!

BB adamnt42 at gmail.com
Mon Nov 21 00:47:16 CET 2022

Tried it out with a few changes.

Dim aState As Integer[] = [spRight, spRight, spLeft, spRight, spRightPlus, spCenter]
   Dim aSpace As Integer[] = [6, 44, 15, 12, 20, 17]
   PrintVarPad(aState, aSpace, True, "ACCT", "NAME", "BALANCE", "PHONE", "DUE", "OTHER STUFF")
   PrintVarPad(aState, aSpace, False, 12345, "Doris Day", Format(45.67, "$,#.00"), "N/A", Now(), Round(Pi, -7))
   PrintVarPad(aState, aSpace, False, 145, "Michaelango Vesputti", Format(125.67, "$,#.00"), Null, Date(Now() - 1))
   PrintVarPad(aState, aSpace, False, 45, "Bozo the Dog", Format(0.05, "$,#.00"), "Woof")
   PrintVarPad(aState, aSpace, False, 666, "The Devil Incarnate Himself", Format(-6666, "$,#.00"), "0666-666-666", Date(666))
   PrintVarPad(aState, aSpace, False, 427, "«Jim Bo»", Format(75.5, "$,#.00"), "0416-763-274 ext 42", Date(2023, 5, 1, 12, 30), 1)


ACCT  NAME                                             BALANCEPHONE         DUE                    OTHER STUFF
----- ------------------------------------------- ----------- ----------- --------------------- ----------------
12345 Doris Day                                         $45.67N/A           21/11/2022 09:50:00     3.1415927
145   Michaelango Vesputti                             $125.67              20/11/2022 00:00:00
45    Bozo the Dog                                       $0.05Woof
666   The Devil Incarnate Hi…                       -$6,666.000666-666-666  28/10/-4800 00:00:00
427   «Jim Bo»                                          $75.50*failed (Bad argument at line 62) here because the input string is too wide*

1) the account column is not right aligned.

2) even though the name column is now wide enough to cope with the 
longest name it is still eliding?

3) the three dots are the elision character from the "special 
characters" dropdown. It only takes one character so as much of the 
string as possible is visible.

4) the balance column does not resize no matter what I set the column 
width to. Also it is overflowing the actual column width by one character.

5) negative dates overflow the allowed column width

6) text that is too wide to fit in the phone column caused it to fail as 
it it trying to pad with a negative number of spaces.

I do like the ability to center a column but I doubt that I would ever 
need it.

It's a good proof of using column widths though. As I said previously I 
went for the column number approach though. One reason for that is I can 
copy the original "ragged" edge output from the console panel and paste 
it into Geany. It is fairly quick therein to pad out a representative 
line with tabs and that gives me the column numbers I need i.e. no need 
to calculate column widths. Mneh! Others may prefer your way.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221121/e3c1626f/attachment.htm>

More information about the User mailing list