On Sun, Jan 20, 2013 at 8:07 AM, Staffan Tylen <staffan.tylen@gmail.com> wrote:
As far as I can tell there is no listview method available that supports the following way to build listview rows:

data = dbConn~exec("SELECT * FROM TBL1;", .TRUE, .ooSQLite~OO_ARRAY_OF_ARRAYS)
self~insertListViewColumns      -- build columns from data[1]
do i = 2 to data~items          -- loop thru all data arrays
   lv~missingMethod(data[i])    -- insert each data array as a listview row
end

This capability could have a significant impact on performance for large data arrays.

Is this something doable? The 'missingMethod' would probably also need to have parameters that specify how to handle .NIL data and possible insert of itemdata. Looking forward to any reactions ;)


Staffan,

It is certainly doable.  

I'm not sure it would have a big impact on performance though.  It would be less lines of coding in Rexx, but that does not always translate to better performance when you are shifting the work from Rexx into the native API.  It depends on how often the native API needs to call back into the interpreter to do the work.  Nevertheless, the only way to know about performance would be to try it.

Have you looked through the documentation on LvFullRow, LvItem, and LvSubitem?  LvFullRow came about though my desire to insert a new list-view item in one method invocation.  However, my main design goal was to be able to specify all bits of data that the list-view supports.

If you open a RFE for this, I'm inclined to implement it.  We can discuss here exactly how it should function.

One idea I have would be something like this:

do i = 2 to data~items          -- loop thru all data arrays
   lv~insertFullRow(.LvFullRow~fromArray(data[i])) data array as a listview row
end

ListView::insertFullRow() already exists.  I would just need to add the LvFullRow class method fromArray(...)

LvFullRow objects have a number of things about them that are designed to assist in working with list-views.  The  LvFullRow object can automatically be set as the item data of the list-view item.  Then, the list-view columns can be sorted internally, which makes sorting of list-views with a large number of items much, much faster.

This would not give you faster insertion of a large number of items though.

A new list-view method, insertRow() could be added that takes an array as an argument is possible

lv~insertRow(.array, itemData, stringValueForNil)

--
Mark Miesfeld