Hi Staffan,

This never showed up in my mail box until you posted the follow up today.

On Mon, Jan 28, 2013 at 4:50 AM, Staffan Tylen <staffan.tylen@gmail.com> wrote:


For that specific line, I believe this will work the same:

  arguments = .array~new(n + 1)
  arguments[n + 1] = "nodeText"
  tc~sendWith('add', arguments)


Mark, I liked the idea of using sendWith so much that I went ahead and changed one of my classes to use this technique instead of interpret, but I can't get it to work. Input is data created by ooSQLite in OO_ARRAY_OF_ARRAYS format. The sendWith call generates the following syntax error with the sample program below, exactly the same that happens with my real program:

Error 88.907:  Argument 2 must be in the range -2147483648 to 2147483647; found "Row1Col2"

The sample program below builds an input array in the same format that ooSQLite would have done.

a=.lv~new
a~execute

::class lv subclass userdialog
::method init
forward class(super) continue
self~create(0,0,200,200)

::method defineDialog
forward class(super) continue
self~createListView(100,0,0,100,100,"REPORT")

::method initDialog
forward class(super) continue
lv=self~newListView(100)
d=.array~new
d[1]=.array~of("Col1","Col2","Col3")
d[2]=.array~of("Row1Col1","Row1Col2","Row1Col3")
d[3]=.array~of("Row2Col1","Row2Col2","Row2Col3")
d[4]=.array~of("Row3Col1","Row3Col2","Row3Col3")
i=0
loop col over d[1]~allItems
     lv~insertColumn(i,col,40)
     i+=1
end
do i = 2 to d~items
   lv~sendWith("add",d[i])
end
::requires "oodialog.cls"

I'm sure this is obvious, I just don't see it. Any ideas?


Sure, I've got ideas.  ;-)

Each add() invocation must have only 1 text item in it.  The text argument defines a label for an item, or the label for a subitem.

d[i] has 3 text arguments in it, so on the face of it, it is going to fail.

This code works:

  i=0
  loop col over d[1]~allItems
       lv~insertColumn(i,col,40)
       i+=1
  end
    
  do i = 2 to d~items
     sqlArray = d[i]
     do j = 1 to 3
        argArray = .array~new(j)
        argArray[j] = sqlArray[j]
        lv~sendWith("add", argArray)
     end
  end

Note that for each array returned from ooSQLite, you need 3 invocations of add().

--
Mark Miesfeld