Page 1 of 1 1
Topic Options
#88974 - 2002-10-26 10:33 PM KixForms: How do you delete a column
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I have been trying to remove a column from a .ListView object. Adding or clearing a column is no problem, but I can not delete it.

I have tried .Remove.

So what is the magic?

I am hoping to be able to delete a column without losing any data in the other columns or at least not the ones before it.

Thanks
_________________________
Kelly

Top
#88975 - 2002-10-26 10:54 PM Re: KixForms: How do you delete a column
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11161
Loc: Boston, MA, USA
You might want to check the KiXForms documantation at http://www.kixforms.freeuk.com/documentation.htm for permitted methods.
_________________________
There are two types of vessels, submarines and targets.

Top
#88976 - 2002-10-26 11:03 PM Re: KixForms: How do you delete a column
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Been there. Done that. Went through the ListView.DOC. Tried searching this site.

I was hoping someone had already tried this.
_________________________
Kelly

Top
#88977 - 2002-10-26 11:12 PM Re: KixForms: How do you delete a column
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8609
Deleting columns will be in the next release, but your right - the syntax will be:

$ListView.Columns(n).Remove

or

$ListView.Columns.Remove(n)

Either one works. I could release the next version tonight - not sure if Rod is around to promote to the web site though ... stay tuned.

Top
#88978 - 2002-10-26 11:23 PM Re: KixForms: How do you delete a column
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Thanks!

Is there a way to add a bunch of items at once without looping through an array? I remember reading talk about it but I have not been able to. Is this in tonight's hopefull release?

Current example:

code:
IF Open (10, $FileComputerList, 2) = 0
$TempComputerList = ''
$LineComputerList = ReadLine (10)
WHILE @error = 0
$TempComputerList = $TempComputerList + $LineComputerList + ','
$LineComputerList = ReadLine (10)
LOOP
$RC = Close (10)
$ArrComputerList = Split (SubStr ($TempComputerList, 1, Len ($TempComputerList) - 1), ',', -1)
FOR EACH $Computer IN $ArrComputerList
$Item = $List.Items.Add
$Item.Text = $Computer
NEXT
ENDIF

_________________________
Kelly

Top
#88979 - 2002-10-26 11:38 PM Re: KixForms: How do you delete a column
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8609
Yeah, that isn't in there yet mostly because I haven't figured out what the correct syntax should be ... are you meaning something like what you can do with the listbox object:

$ListBox.List = 1,2,3,4,5,6

If yes, yeah - I haven't nailed down the syntax for ListView yet, maybe like

$ListView.Items = 1,2,3,4,5,6

Is this what your meaning ?

-Shawn

[ps] Just as an FYI, one might ask themselves why there are two methods for deleting columns (or items), the first example above:

$ListView.Columns.Remove(n)

asks the Columns collection to delete a particular column from its collection, the second example:

$ListView.Columns(n).Remove

asks a particular column to remove ITSELF from the collection - subtle difference but same effect.

Top
#88980 - 2002-10-26 11:47 PM Re: KixForms: How do you delete a column
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Yes. I was not sure if was going to be from a string list or an array? How did you plan on working with multiple columns?

code:
Computer    Ping    Access
Computer1 Yes Yes
Computer2 Yes No
Computer3 No No

_________________________
Kelly

Top
#88981 - 2002-10-26 11:53 PM Re: KixForms: How do you delete a column
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8609
You hit the nail right on the head. Thats exactly what im trying to figure out right now, multicolumn data, was thinking about something like this. If you wanted to create an internalize version of a Kixtart table, say that contained 3 rows by two columns, could do this (define and load a two dimensional table):

dim $rows[2] ; Three rows (0-2)

$Rows[0] = "Shawn,173
$Rows[1] = "krabourn",1462
$Rows[2] = "sealeopard",336

$ListView.Items = $Rows

This would load the complete table into the ListView ... Any others thoughts/ideas/ways we can achieve this ?

[ 26. October 2002, 23:54: Message edited by: Shawn ]

Top
#88982 - 2002-10-27 12:27 AM Re: KixForms: How do you delete a column
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
How about a way to define the Column and Row count and then load the data straight into the ListView bypassing the extra array?
_________________________
Kelly

Top
#88983 - 2002-10-27 12:37 AM Re: KixForms: How do you delete a column
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8609
You mean like this ?

code:
 
$List.Columns.Count = 3
$List.Items.Count = 10

For Each $Item in $List.Items
$Item.Text = "krabourn"
$Item.SubItems(1).Text = "was"
$Item.SubItems(2).Text = "here"
Next

?

[ 27. October 2002, 00:38: Message edited by: Shawn ]

Top
#88984 - 2002-10-27 04:33 AM Re: KixForms: How do you delete a column
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I don't have much experience with Multi-Dimensional arrays. The following is for a single dimension array. Creating all the items first seems to run faster than looping and creating them one by one.

I am just not sure, yet, how I am going to read a file and add the info to a multi-dimensional array, which would be the ListView. Sometimes things have to ramble in my head for a day or two.

code:
IF Open (10, $FileComputerList, 2) = 0
$TempComputerList = ''
$LineComputerList = ReadLine (10)
WHILE @error = 0
$TempComputerList = $TempComputerList + $LineComputerList + ','
$LineComputerList = ReadLine (10)
LOOP
$RC = Close (10)
$ArrComputerList = Split (SubStr ($TempComputerList, 1, Len ($TempComputerList) - 1), ',', -1)
$List.Items.Count = Val (UBound ($ArrComputerList) + 1)
FOR $Index = 0 TO Val (UBound ($ArrComputerList))
$List.Items($Index).SubItems(0).Text = $ArrComputerList[$Index]
NEXT
; FOR EACH $Computer IN $ArrComputerList
; $Item = $List.Items.Add
; $Item.Text = $Computer
; NEXT
ENDIF

_________________________
Kelly

Top
Page 1 of 1 1


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

Who's Online
2 registered (Allen, ShaneEP) and 158 anonymous users online.
Newest Members
Sjaak, Biybucket, Markus1961, Ian231, kixnewbie12
17480 Registered Users

Generated in 0.036 seconds in which 0.012 seconds were spent on a total of 12 queries. Zlib compression enabled.

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