yet another Listbox on demand ...

ListboxOnDemandCC is a custom control with a “normal” Listbox plus extensions.
ListboxOnDemandCC extends the normal Listbox in Xojo which has the limitation of 64 columns.
The ListBoxOnDemandCC stores (and displays) only the visible data cells in the Listbox control,
the complete data ist stored in a 2-dimensional array.
For instance you can add data with 1000 columns and 2000 rows.
Scrolling through the data (ScrollBar or mouse wheel) is fairly fast.
Arrow keys up/down left/right scrolls through the data step by step.
A heading row is present.
Sorting Text ascending/descending is possible and fairly fast.

Single line selection is possible. Additionally, you can see the selected column as well
(brighter color in the row for selected column).

Anyone interested in testing an early state of the control?
Feedback and suggestions are welcomed.

Thomas

You forgot the link.

I wanted to know first if there is someone interested in … because there are already other solutions …

Here are the links for the Mac-Version

https://www.dropbox.com/s/tegdmlix5mywlpt/ListBoxOnDemand_Mac.app.zip?dl=0

and for the Win-Version

https://www.dropbox.com/s/hjyokvnehuob5mh/ListboxOnDemand_win.zip?dl=0

Thomas

Seems to work well. 99,999 rows and 500 columns was very smooth on OS X after the delay for loading.

I am wondering what happens if you stuff your listbox cell with data which is longer than the columnwidth. Do you use drawstring with condense ?
You can easily archive a great scrollingspeed if you cache the objects you’ve printed in the cellpaint event.

Although you can display a vast of columns your listbox needs further tweaks I think. Just an incomple example of and old
custom listbox using cache. Using a cache is a different ball game.

https://www.dropbox.com/s/1fz4j4nq0jm3kjg/ListBox_Cache4.xojo_binary_project?dl=0

You’re listbox is still fast though.

Thanks :slight_smile: .

[quote=181103:@Rob Egal]I am wondering what happens if you stuff your listbox cell with data which is longer than the columnwidth. Do you use drawstring with condense ?
You can easily archive a great scrollingspeed if you cache the objects you’ve printed in the cellpaint event.

Although you can display a vast of columns your listbox needs further tweaks I think. Just an incomple example of and old
custom listbox using cache. Using a cache is a different ball game.

https://www.dropbox.com/s/1fz4j4nq0jm3kjg/ListBox_Cache4.xojo_binary_project?dl=0[/quote]

Thanks for the example. But the listbox cannot have more than 64 columns, correct?
The ListboxOnDemandCC can handle 1000 columns without problems.

I do not use drawstring or something else. It is the ordinary Listbox from XOJO. Displaying more than 64 visible columns is not possible :slight_smile: but I think there is nearly no circumstance (only very large Monitors) where you can display more than 64 columns for proper reading. If the columns too little for the entire text then it behaves as a normal Listbox (dots right hands).
You can alter the width of each column as you do for the normal XOJO Listbox. The next cell will be shorter in width than.

I want to preserve the most functionality of the XOJO Listbox at the end (with all the pros and cons …). Editing is possible (you can do this by double click on a cell but it is buggy at the moment, have not fixed it since now).

Inserting data is easy:

ListboxOnDemand.setData(variableNames(), data(row,col), numberOfVisibleColumns)

Thomas

Variety is always good. Very fast on my laptop.

It’s slow on my laptop.

CPU: i3
RAM: 4gb
OS: Windows 8

On my MacBook Pro 17" from 2012 I can’t scroll on the trackpad from row to row, it always scrolls at least two rows no matter how slow I drag my two fingers on the trackpad.

This is strange. I’ve got an i5, also 4GB, Mac OS 10.9.5. I tried with 100.000 rows.

[quote=181132:@Ashot Khachatryan]It’s slow on my laptop.

CPU: i3
RAM: 4gb
OS: Windows 8[/quote]

Yes, I have seen that on my virtual machine too. I have - since now - developed on the mac but not on a windows machine. Seems that I have to fix this especially for windows.

Thomas

Yepp, same here. Strange … I have to fix this.

Thomas

Thank you all for testing!

As I have written before … it is a early stage of the custom control.
On the Mac it is fairly fast … but this seems not to be the case for windows.
Does anyone knows which Linux distribution works well with XOJO programs?

By the way I use a macbook pro, mid 2012, 13’’, 3.3 GHz i7 with 8 MB RAM, Yosemite 10.10.3
What can slow down is the used memory for the 2-dimensional String Array …

Thomas

Some time ago I developed my own data on demand listbox subclass. I can load 100.000 records and scrolling is as fast as with 100 records. The way I manage this, is not to have 100.000 rows added to the listbox, but only as many rows as there can be visible. Of course the vertical scrollbar needs to be a separate control. So I did put both the listbox and the vertical scrollbar into a ContainerControl and added all of the listbox API to the ContainerControl.

The same approach that I use. I do only insert the visible rows/cols into the Listbox. BOTH scrollbars are seperate controls. My Listbox is also in a container control :slight_smile: .
The problem with the scrolling should I fix. But I cannot do this now, I think in the next day I will have time.

Thank you for your hints, all is helpful.

Thomas

That’s the way to go if you really want a speedy listbox but you need to build it from scratch. Everything based in the build-in listbox suffers from the same issues. You’ll be over on over fixing those issues. It’s possible to make a complete custom listbox but takes a lot of time.

For me that’s not true, I use the built-in listbox and it is extremely fast. Of course you need a really fast data structure to hold the data within the ContainerControl – that’s where it can become slow. As an example: a two-dimensional array holding the cell values is way slower than an array of objects.

[quote=181227:@Rob Egal]It’s possible to make a complete custom listbox but takes a lot of time.[/quote]Is such a case I’d rather spent time in wrapping native controls like NSTableView.

A new version of the Listbox control is available for testing. Not much is changed till now, but some fixes about scrolling. I hope the windows version is now faster. On my virtual machine it is.

I am agree with Eli Ott. I do not want to program a complete Listbox from the scratch, but some limitations of the original Listbox are disappointing for me. The main problem is the column limitation. If I want to show database data the limitation is always a problem.

At the end I want to be able to alter cells of the ListboxOnDemandCC that can be saved back into a csv-file or database.

Test Application for scrolling:

Mac-Version
https://www.dropbox.com/s/tegdmlix5mywlpt/ListBoxOnDemand_Mac.app.zip?dl=0

Win-Version
https://www.dropbox.com/s/hjyokvnehuob5mh/ListboxOnDemand_win.zip?dl=0

Thomas