Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Jul 14, 2002 1:38 am Post subject: Columns in a List Box... |
|
|
If you have data that can be parsed (or single data items), it's
fairly easy to make columns in a list box, just make sure each
data item is added to the string at the same point (number of
chars) for each line. To do this, we pad the string with blank
spaces.
You must use a font with same width letters (Courier, etc.). It's
also easier if all your columns are the same width, but you can
make adjustments for wider columns by adding spaces to them
in the loop.
__________________________________________________________________________________________________________________________
Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Test Prog,-1,0,380,200
DIALOG ADD,STYLE,Style1,Courier New,10,B
DIALOG ADD,TEXT,T1,3,2,,,"Column1 Column2 Column3 Column4",,Style1
DIALOG ADD,LIST,L1,20,0,380,175,,Style1
DIALOG SHOW
LIST CREATE, 1
LIST ADD, 1, "Data|Line 1|More|More1"
LIST ADD, 1, "Ln. 2|Ln 2|Ln 2 Txt|Resize"
LIST ADD, 1, "Ln. 3|Ln 3 txt|Ln. 3|Resize col"
%x = 0
REPEAT
rem -- Use -1 to allow for zero start --
%%pad = -1
PARSE "%a;%b;%c;%d", @item(1, %x)
%s = %a
GOSUB PadString
%s = %s%b
GOSUB PadString
%s = %s%c
GOSUB PadString
%s = %s%d
LIST ADD, L1, %s
%x = @succ(%x)
UNTIL @equal(%x, @count(1))
:EVLOOP
WAIT EVENT
goto @event()
:CLOSE
EXIT
rem -------------- GOSUB --------------
:PadString
%%pad = @sum(%%pad, 12)
REPEAT
%s = %s" "
UNTIL @greater(@len(%s), %%pad)
exit
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|