Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » large ArrayCtrl
large ArrayCtrl [message #470] |
Wed, 04 January 2006 14:28 |
hojtsy
Messages: 241 Registered: January 2006 Location: Budapest, Hungary
|
Experienced Member |
|
|
Hi,
I have a data table which would fit in a matrix of 20 * 100.000 cells, of approx 50MB size. This seems to be too big to be directly stored in the ArrayCtrl, especially if multiple ArrayCtrls could be opened for the same data table. It would be good to just tell the ArrayCtrl the dimensions of the matrix, and a location of a callback function where the cell data could be accessed on demand. Is this already provided? If not, what would be the simplest way to implement it from client code?
thanks,
Sandor
|
|
|
|
|
|
Re: large ArrayCtrl [message #839 is a reply to message #478] |
Sat, 04 February 2006 11:18 |
hojtsy
Messages: 241 Registered: January 2006 Location: Budapest, Hungary
|
Experienced Member |
|
|
I created an example for the big arrays using AddRowNumColumn, SetVirtualCount and Convert. It displays the textual representation of numbers from 1-900000. It may be a candidate for inclusion in the reference dir, since there are no examples for ArrayCtrl with virtual rows.
-
Attachment: BigArray.zip
(Size: 1.14KB, Downloaded 2243 times)
[Updated on: Sat, 04 February 2006 11:47] Report message to a moderator
|
|
|
Re: large ArrayCtrl [message #840 is a reply to message #839] |
Sat, 04 February 2006 12:10 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Good idea. I have changed it a little
#include <CtrlLib/CtrlLib.h>
static String sNumberAsText(int number)
{
static const char * const digits[20] = {
"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
"seventeen", "eighteen", "nineteen"
};
static const char * const tens[10] = {
"", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"
};
if(number < 20)
return digits[number];
if(number < 100)
return tens[number / 10] + String(" ") + sNumberAsText(number % 10);
if(number < 1000)
return digits[number / 100] + String(" hundred ") + sNumberAsText(number % 100);
if(number < 1000000)
return sNumberAsText(number / 1000) + " thousand, " + sNumberAsText(number % 1000);
return "";
}
struct NumberToText : public Convert {
virtual Value Format(const Value& q) const {
int n = q;
return n == 0 ? String("zero") : sNumberAsText(n);
}
};
GUI_APP_MAIN
{
ArrayCtrl array;
array.AddRowNumColumn("number", 20);
array.AddRowNumColumn("text", 80).SetConvert(Single<NumberToText>());
array.SetVirtualCount(900000);
TopWindow win;
win.Zoomable().Sizeable();
win.Add(array.SizePos());
win.Run();
}
and saved as reference/VirtualArray.
Note that some issues you have done in a little bit complicated way - I am not sure whether you wanted to demostrate other things, however I decided to use to smallest possible code (as I always try for reference examples).
Mirek
|
|
|
|
Re: large ArrayCtrl, virtual array count limits [message #19156 is a reply to message #840] |
Sat, 15 November 2008 18:20 |
jaynorwood
Messages: 7 Registered: May 2008
|
Promising Member |
|
|
I'm experiencing limits in the VirtualArray example beyond which there is no refresh. It works for 100million, but not 200million virutal array count in its current form.
I attempted changing some parameters to int64, but the limit still occurs. Below is my modified code.
I'm a bit surprised at the 200 million limit. I thought perhaps a 2Gig limit in the original due to the signed int parameter range.
Aside from figuring out what this strange 200 million limit is about, I'd like to see the framework improved so that int64 ranges could be used throughout.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
static String sNumberAsText(int64 number)
{
static const char * const digits[20] = {
"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
"seventeen", "eighteen", "nineteen"
};
static const char * const tens[10] = {
"", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"
};
if(number < 20)
return digits[number];
if(number < 100)
return tens[number / 10] + String(" ") + sNumberAsText(number % 10);
if(number < 1000)
return digits[number / 100] + String(" hundred ") + sNumberAsText(number % 100);
if(number < 1000000)
return sNumberAsText(number / 1000) + " thousand, " + sNumberAsText(number % 1000);
if(number < 1000000000)
return sNumberAsText(number / 1000000) + " million, " + sNumberAsText(number % 1000000);
if(number < 1000000000000ULL)
return sNumberAsText(number / 1000000000) + " billion, " + sNumberAsText(number % 1000000000);
return "";
}
struct NumberToText : public Convert {
virtual Value Format(const Value& q) const {
int64 n = q;
return n == 0 ? String("zero") : sNumberAsText(n);
}
};
GUI_APP_MAIN
{
ArrayCtrl array;
array.AddRowNumColumn("number", 20);
array.AddRowNumColumn("text", 100).SetConvert(Single<NumberToText>());
array.SetVirtualCount(200000000);
TopWindow win;
win.Zoomable().Sizeable();
win.Add(array.SizePos());
win.Run();
}
|
|
|
Re: large ArrayCtrl, virtual array count limits [message #19172 is a reply to message #19156] |
Sun, 16 November 2008 18:58 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
jaynorwood wrote on Sat, 15 November 2008 12:20 | I'm experiencing limits in the VirtualArray example beyond which there is no refresh. It works for 100million, but not 200million virutal array count in its current form.
|
Well, not that is I would call "pushing to the limits"
Quote: |
I'm a bit surprised at the 200 million limit. I thought perhaps a 2Gig limit in the original due to the signed int parameter range.
|
IMO, this is caused because of the height of line in pixels. That is about 15 pixels, means maximum is close to 2G / 15.
Quote: |
Aside from figuring out what this strange 200 million limit is about, I'd like to see the framework improved so that int64 ranges could be used throughout.
|
Uh, that would work only as long as somebody does not decide to test int64 limits IMO.
Seriously, if your real world application needs 200 millions of lines in table TO BE PRESENTED AT ONCE, something is wrong with your UI design.
Also, realistically, any nontrivial usage would require those data to come from somewhere, and that would take eons.
Making these limits int64 would meant making EVERYTHING 64bit, with ugly impacts on code compactness and speed.
Mirek
|
|
|
Re: large ArrayCtrl, virtual array count limits [message #19174 is a reply to message #19172] |
Sun, 16 November 2008 20:47 |
jaynorwood
Messages: 7 Registered: May 2008
|
Promising Member |
|
|
Well, we have a large database ... perhaps 4G records ... being generated from microprocessor trace data, and I thought perhaps your virtual array control could be used as a front end to move around in the data in a flat mode. This limitation on the scrolling range seems rather arbitrary with as much template parameter support as there is in other areas of the code. I don't see why the scrolling limits couldn't be just another template parameter.
I seem to recall that eclipse jface or swt even supports bignum scrolling ranges with their virtual array, so it isn't like this is an out of the ordinary expectation for the virtual array.
|
|
|
Goto Forum:
Current Time: Mon May 06 03:00:22 CEST 2024
Total time taken to generate the page: 0.08088 seconds
|