Page 2 of 2 <12
Topic Options
#88594 - 2002-10-09 04:18 PM Re: Kixforms - Whats the "view" on "listviews"
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Sure , I see ...

Hmmm, then keeping it as compatible with excel as possible (ie leave it as it is) would be the way as for example one could read in data from a spreadsheet and populate a Listview within the same loop with the same counters and parameters and vice versa.
PLUS - I already get used to it as it is by now [Razz]

Jochen
_________________________



Top
#88595 - 2002-10-09 04:22 PM Re: Kixforms - Whats the "view" on "listviews"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I don't fancy excel and don't anymore need to as have listviews [Razz]

but what comes to the counter, I like the idea of having two dimensional array or tab/csv-file and easily get those in listviews with same counters.

just need to see how far we can go with this before hit the roof...
_________________________
!

download KiXnet

Top
#88596 - 2002-10-09 05:00 PM Re: Kixforms - Whats the "view" on "listviews"
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I was thinking about that too - in some of the custom grid controls i studied - they built in a function called load or import that would take a csv or xml file and import it into the sheet. But I don't know man ... the object model as it stands today is pretty powerfull and its only going to get better. Here's a script I've always wanted to write, you provide a path to a CSV file on the command line and it automatically builds a listview with column headers and everything. To use it, you just need to edit the csv file and put some header info on the first line. Hope this works for anyone that tries because im running the next maintenance build of forms (2.1.1).

You run it like this:

kix32 list.kix $filename=.\test.csv

[TEST.CSV]
code:
File,Date,Size,Version
"C:\WINNT\VMMREG32.DLL","1996/10/13 21:38:00","24336","4.00"
"C:\WINNT\CD32.EXE","2001/10/17 04:31:28","634087",""
"C:\WINNT\CLSPACK.EXE","2001/01/12 14:04:03","49424","5.00.3802"

and the code:

code:
;
; KIXTART 4.12
; KIXFORMS 2.1.0
;
; Accepts a command-line parameter called $filename that specifies the
; file to use. If not specified, looks for a file called TEST.CSV in
; current directory

break on

;
; usage: kix32 script [$filename="filename.csv"]
;

if not $filename
$filename = ".\test.csv"
endif

if not exist($filename)
?"$filename not found."
quit
endif

$form = createobject("kixtart.form")
$form.fontname = Verdana
$form.fontsize = 8
$form.clientsize = 800,600

$list = $form.listview
$list.location = 10,10
$list.width = $form.clientwidth - 20
$list.bottom = $form.clientheight - 20

if open(1,$filename) = 0
$titles = readline(1)
if $titles
for each $title in split($titles,",")
$list.columns.add.text = $title
next
endif
$line = readline(1)
while @error = 0
if $line
$item = $list.items.add
$fields = split($line,",")
for $i = 0 to ubound($fields)
if substr($fields[$i],1,1) = '"'
$fields[$i] = substr($fields[$i],2)
endif
if substr($fields[$i],len($fields[$i]),1) = '"'
$fields[$i] = substr($fields[$i],1,len($fields[$i])-1)
endif
$item.subitems($i).text = $fields[$i]
next
endif
$line = readline(1)
loop
if $list.items.count
for each $column in $list.columns
$column.width = -1
$column.width = -2
next
endif
$=close(1)
endif

$form.center
$form.show

while $form.visible
$=execute($form.doevents)
loop

exit 1



[ 09. October 2002, 17:02: Message edited by: Shawn ]

Top
#88597 - 2002-10-09 07:23 PM Re: Kixforms - Whats the "view" on "listviews"
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm - im having second thoughts on the interface now (which i have been known to have) Maybe I didn't look far enough into the future - dont know - but would like to make the listview sort of the "center piece object" of the forms library ... down the road - have plans to implement a super listview called listgrid (something like that) that will have real cells where one can navigate around and edit them and enter data - same as excel ... plus - i would like to upgrade the LISTBOX and COMBOBOX to support these new grid methods. Scratching my head now ... maybe an interface like this would "read" better ?

Conceptualized code here:

code:
;
; KIXTART 4.12
; KIXFORMS 2.1.0
;

break on

$form = createobject("kixtart.form")
$form.fontname = Verdana
$form.fontsize = 8
$form.clientsize = 640,480

$list = $form.listview
$list.bounds = 10,10,500,200

; Add some columns ...

$list.columns.count = 3
$list.columns.text = "Name","Address","Phone"

; Add some rows ...

$list.rows.count = 4

; Load some data ...

$list.rows(0).text = "John Doe 1", "1 Maple Street", "123-456-7890"
$list.rows(1).text = "John Doe 2", "2 Maple Street", "123-456-7890"
$list.rows(2).text = "John Doe 3", "3 Maple Street", "123-456-7890"
$list.rows(3).text = "John Doe 4", "4 Maple Street", "123-456-7890"

; Select all the rows ...

for each $row in $list.rows
$row.selected = true
next

$form.center
$form.show

while $form.visible
$=execute($form.doevents)
loop

exit 1

Its no problem to change the interface - just want to decide early (like now).

[ 09. October 2002, 19:23: Message edited by: Shawn ]

Top
#88598 - 2002-10-09 11:25 PM Re: Kixforms - Whats the "view" on "listviews"
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
I presume you gonna leave SubItems(x) in it, or shall I say $list.rows(0).cells(n).text = "blah" ...

So no problem with me, go ahead [Smile]
_________________________



Top
#88599 - 2002-10-09 11:38 PM Re: Kixforms - Whats the "view" on "listviews"
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ping jochen ...

yeah ... you got it ... plus, was thinking about allowing the cells collection to be used at two levels - at the row level and at the list level, fe:

$list.row(1).cells(0).text = "text"

$list.cells(1,0).text = "text"

yeah ... think im liking this more and more. its not a big huge change - more naming terminology than anything else ... but I think its worth the time to do this right. Anything I ever read about listviews and grids (even with dotnet) talks about ROWS and COLUMNS and CELLS .. so why not just call them that.

Top
#88600 - 2002-10-09 11:40 PM Re: Kixforms - Whats the "view" on "listviews"
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hehe ,

and we won't have much code to change by now !
My vote for it [Big Grin]
_________________________



Top
#88601 - 2002-10-09 11:48 PM Re: Kixforms - Whats the "view" on "listviews"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
is this change to be seen in 2.1.1 or should I stop writing my crap?
_________________________
!

download KiXnet

Top
#88602 - 2002-10-09 11:52 PM Re: Kixforms - Whats the "view" on "listviews"
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
well do this for 2.1.1 ... this saturday ... i wouldn't stop coding - you should only have to change a line or three in the script, fe

items -> row
subitems -> cells

Top
#88603 - 2002-10-09 11:54 PM Re: Kixforms - Whats the "view" on "listviews"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm... line or two, quess my code is weird as the lines grow...

but don't worry, I'll be spelling out some new awful code soon...
_________________________
!

download KiXnet

Top
#88604 - 2002-10-09 11:57 PM Re: Kixforms - Whats the "view" on "listviews"
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
see, your way too fast for us jooel, by the time most folks get around to reading the white paper - you've already coded an inventory script.
Top
#88605 - 2002-10-10 12:16 AM Re: Kixforms - Whats the "view" on "listviews"
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yeah !

Stop that please !!! (just kidding [Big Grin] )
_________________________



Top
Page 2 of 2 <12


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 492 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.066 seconds in which 0.028 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org