ShawnAdministrator
(KiX Supporter)
2002-09-05 02:37 AM
RFC: Kixforms: Change to AddItem for Mutli-Column ListView Control

Would anyone care (or have an opinion) on the thought (need) to change the behavior of the ADDITEM method. In order to "better" support MultiColumn ListViews in KixForms, I would like to extend the ADDITEM method to include a return value ... the Index of the Row that is added, for example, this is how MultiColumn is shaping-up right now. This example uses ADSI to load a 3 column ListView object with user details:

code:
$ListView = $Form.ListView

$ListView.Size = 400,300
$ListView.Center

$ListView.AddColumn("Name",100)
$ListView.AddColumn("Full Name",150)
$ListView.AddColumn("Status",50)

$Domain = GetObject("WinNT://@WKSTA")

If $Domain

$Domain.Filter = "User",""

For Each $User In $Domain

$Row = $ListView.AddItem($User.Name)

$ListView.List($Row,1) = $User.FullName

$ListView.List($Row,2) = "OK"

Next

EndIf

The thingy is that the ListBox also responds to the AddItem method ... so basically any script (today) that uses AddItem to load a ListBox will have to do the old "Silence Function" routine else get numbers piped to the DOS console ... would this be an issue for anyone.

Actually ... the AddItem method was always "supposed" to return a value ... just that I mistakeningly didn't implement it.

-Shawn

ps. Oh yeah ... anyone have any thoughts/comments (just based on code above) about how all these MultiColumn methods and properties work ... was thinking about making it more "spreadsheet-like" .. with methods like

$ListView.AddColumn(...)
$ListView.AddRow(...)
$ListView.Cell($Row,$Col) = $Thingy

still playing with that ... problem is ... vb and .net don't work like that ... but from an abstraction standpoint ... I feel that it is "easier" to wrap my mind around a MutliColumn ListView treated as a spreadsheet, or a grid, with "rows" - not "items ... and "cells" - not "list" ... oh well ... any psuedo-coders out there feel like abstracting ?

[ 05. September 2002, 02:40: Message edited by: Shawn ]


punkie
(Getting the hang of it)
2002-09-05 08:34 AM
Re: RFC: Kixforms: Change to AddItem for Mutli-Column ListView Control

I think that spreadsheet thing would be good, it seems easier to use somehow.

Chris S.
(MM club member)
2002-09-05 02:39 PM
Re: RFC: Kixforms: Change to AddItem for Mutli-Column ListView Control

The 'spreadsheet' thingy sounds good to me. It seems like it might make it easier to add features to in future versions to KiXforms as well.

ShawnAdministrator
(KiX Supporter)
2002-09-05 03:56 PM
Re: RFC: Kixforms: Change to AddItem for Mutli-Column ListView Control

I like the spreadsheet abstraction too. Here's a thought though, and unfortunately, as issue to be dealt with:

1) The ListBox object is much like the ListView object. I tend to think of ListBox as a single column spreadsheet or grid (without the headings). There are already methods and properties for manipulating ListBoxes (AddItem,List,Value,ListCount) ... and a case can be made for "recycling and reusing" these already established mechanisms for managing the list ... just "enhanced" a bit for MultiColumn support. You know the benefits ... only have to remember one set of thingys for both controls. Either that, or come out with a new set (spreadsheet-like) set, and apply them to the ListBox as well.

2) A bigger problem has popped-up. I think I've uncovered a BUG in V4.0+ of Kixtart to do with the following syntax in COM:

$object.property(x,y) = value

the x,y thingy doesn't work in Kixtart (it should though) ... I've already verified the Kixforms code with other scripting languages (VB & VBS) and it works well.

You see this x,y thingy quite a bit in EXCEL Automation ... like if you check-out Erik (kholms) Excel UDF suite ... there's a ton of these references, ie:

$sheet.range("A1:A2").value = "whatever"

same thing ... except with Kixforms, there is no .value reference afterwards ... this "flavor" seems to work ok ... the other doesn't.

I've already sent Ruud a bug report on this ... but it maybe be a while before its fixed ... not too sure if I should wait for it to be fixed, or devise some kind of different strategy - probably best to wait though ... will advise if I hear anything back from Ruud.

-Shawn

[ 05. September 2002, 15:57: Message edited by: Shawn ]