[Gambas-user] TableView Problem

Benoit Minisini gambas at ...1...
Wed Nov 2 18:14:36 CET 2005


On Wednesday 02 November 2005 17:57, nando wrote:
> Thank you to the all who gave examples for TableView.
>
> TableView is still implemented incorrectly.
>
> TableView, *unlike* controls in VB (like Flexgrid), requires
> a 2D array of some data (integer,string,etc) to 'refresh' the
> TableView when it needs it. Hundreds of events fire wasting the CPU.
> TableView is supposed to be like that in Flexgrid and others.
> When data is placed in a cell, it is held static there until it is
> changed.  It is not the responsibility of Program code to refresh it.
> It is the responsibility of the control to do that.
> Scrolling the Tableview (or clicking on it) isn't supposed to
> require _Data event to fire because the data is already in cells.
>
> Why does the data disappear when scrolled ?
> It's not supposed to.
> It doesn't make sense.
> Even the QT control works 'statically'
> TableView is implemented incorrectly.
>

It is not "incorrect", it is just the way it is designed.

> If one is to have a TableView with data from many tables in MySQL,
> this means that all scrolling and clicking REQUIRES the MySQL
> queries be performed repeatedly because the cells are 'erased' every
> scroll.  

You don't.

Once you have have done the query, you can keep it in memory and use it each 
time you have to handle the Data event.

> If it is a complex page with a lot of scrolling, 
> we are speaking of hundreds and thousands of queries.
> Or, if, instead, a 'shadow' array is kept, then hundreds and thousands
> of events are fired (_Data) just to repaint.
>

> This is not correct.
>
> But, perhaps, I am missing something.
>
> Please inform me of my mis-understanding and mis-quidance.
>
> -Fernando
>

A good way to handle all these things would be having a "data source" model 
that allows any control to manage its data itself (like TreeView, 
ColumnView...), or to let the user provides the data on demand (like 
TableView).

Both methods are useful. There is no one "correct" method, and another "not 
correct".

But this "data source" model have to be done!

Regards,

-- 
Benoit Minisini





More information about the User mailing list