forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Columns in a List Box...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sun Jul 14, 2002 1:38 am    Post subject: Columns in a List Box... Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group