Re: [Gambas-user] Slow Gridview creation

2009-03-29 Thread Fabien Bodard
good work !

2009/3/27 Jesus Guardon jguar...@telefonica.net:
 Fabien Bodard escribió:

 simply the handle name is not good... you have named your gridview
 gv and not GridView1... it's an usual copypaste error ;-)


 Ha ha... it's my mistake. Finally I get it working, really really fast
 method. A lot of thanks for your help, I was mind-closed for a while!

 Here is the final class:


 Thanks again

 Jesús

 --

 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user



--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Slow Gridview creation

2009-03-27 Thread Rolf-Werner Eilert
No, you don't fill it, it fills itself :-)

As soon as you change anything in the gridview (number of rows/columns 
for instance) or there is any event forcing it to rewrite its contents 
(the user switching screens or a .Refresh by your code), it jumps into 
the _Data event for every cell and reloads them.

So you just have to keep the contents prepared for it in the array in 
the background as Fabien has shown:

dim myarray[16000,16000]

Here is where you store your data for each cell.

As soon as you or your code gives the gridview a reason to start 
updating (in Fabien's example: Rows.Count and Columns.Count), it will 
jump into the _Data event and fetch its data for every cell from there:

public sub gridview1_data(row as integer, column as integer)

   gridview1.data.text = myarray[row, column]

end


Hope it helps...

Rolf


Jesus Guardon schrieb:
 Thanks for reply, but still not clear...
 
 Your example only draws a grid with empty cells. I can't figure out how 
 to fill the grid with a database result object, even with a simple 
 array. Please, open my eyes!! :-((
 
 Jesus
 
 Fabien Bodard escribió:
 in fact jesus , you don't feel the grid,
 the grid just call the visible cells content via the event.

 dim myarray[16000,16000]

 public sub _New()

   gridview1.Rows.Count = 16000
   gridView1.Columns.Count = 16000

 end


 public sub gridview1_data(row as integer, column as integer)

   gridview1.data.text = myarray[row, column]

 end


 so you don't make any change in the data in the gridview but in the
 array it self...

 it's a data/view model.  a variable that store the datas and a widget
 that just walk on the content.

 2009/3/26 Jesus Guardon jguar...@telefonica.net:
 Hi all

 I'm trying to implement the Data event handler, but I cannot understand
 the way it must be done. I am locked out, sorry for my awkwardness.
 Can anyone provide a basic working example? I need to fill a gridview
 with 16000+ rows.

 Thanks in advance!

 Jesús

 Benoit Minisini escribió:

 You must do exactly what is written in the documentation: instead of 
 setting
 the data explicitely, you must implement the Data event handler. In this
 event handler, you will receive the Row and Column of the cell to fill, and
 in return you set the properties of the GridView.Data property to define 
 the
 cell contents.

 PUBLIC SUB MyGridView_Data(Row AS Integer, Column AS Integer)

   MyGridView.Data.Text = Row   :   Column

 END

 --
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

 --
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

 
 
 --
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Slow Gridview creation

2009-03-27 Thread Jesus Guardon
Still nothing... Data event seems to be not fired.

Please, check the modified example:

http://www.ea7dfh.es/demotableview.tar.gz

This includes the sqlite3 database and is too big to attach in the 
e-mail.( ~600 Kb)

What I'm doing wrong?

Regards and thanks for your patience

Jesús

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Slow Gridview creation

2009-03-27 Thread Fabien Bodard
simply the handle name is not good... you have named your gridview
gv and not GridView1... it's an usual copypaste error ;-)

PUBLIC SUB gv_Data(Row as integer, Column as integer)

you have put the column between comma... this pactice is for the
translated strings... but if you translate column headers ... they
will not match with  the db entries... i think it will be better to
use a separate string array to store the fields name.



private $aMyFields as string[]= [field1, field2, Field3, Field4]

public sub _new()
gv.columns.count = $aMyFields.count

gv.columns[0].text = id
gv.Columns[1].text = (name)' that can be nom in french
etc...



public sub gv_data(...

result.moveto(row)
gv.data.text=result[$aMyFields[column]]



Regards,
Fabien


2009/3/27 Jesus Guardon jguar...@telefonica.net:
 Still nothing... Data event seems to be not fired.

 Please, check the modified example:

 http://www.ea7dfh.es/demotableview.tar.gz

 This includes the sqlite3 database and is too big to attach in the
 e-mail.( ~600 Kb)

 What I'm doing wrong?

 Regards and thanks for your patience

 Jesús

 --
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Slow Gridview creation

2009-03-27 Thread Jesus Guardon

Fabien Bodard escribió:

simply the handle name is not good... you have named your gridview
gv and not GridView1... it's an usual copypaste error ;-)



Ha ha... it's my mistake. Finally I get it working, really really fast 
method. A lot of thanks for your help, I was mind-closed for a while!


Here is the final class:


Thanks again

Jesús


frmGridView.class
Description: application/java-vm
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Slow GridVIew creation

2009-01-28 Thread mohareve
This is an excerpt from my program:

visszhang = DBconX.Exec(quert)
FOR EACH visszhang
nev.Add(visszhang!FName)
ut.Add(visszhang!FPath)
nagy.Add(Round(visszhang!FSize / 1048576, -2))
mikor.Add(visszhang!FChanged)
kotet.Add(point)
NEXT
dis = nev.Count 
gV.Rows.Count = dis
FOR i = 0 TO dis - 1
gV[i, 0].Text = nev[i] 
gV[i, 1].Text = kotet[i]
gV[i, 2].Text = ut[i]
gV[i, 3].Text = nagy[i]
gV[i, 4].Text = mikor[i]
NEXT

The problem is:
I'm handling a database, and during the querries I need to operate with tens of 
thousands of five-columned rows. It is desperately slow creation. Is it 
possible to change the algorithm and make it faster?
Currently I'm filling the rows from 5 previously created arrays. I need some 
help, thanks!

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Slow Gridview creation

2009-01-28 Thread Benoit Minisini
On mercredi 28 janvier 2009, M. Cs. wrote:
 Dear Benoit,
 I would like to know whether it is possible to make GridView creation and
 filling process faster. I'm using databases for storage, then I'm doing the
 querries, which are giving tens of thousand results, or tens of thousand
 rows with five columns each. First, I put the results into five separated
 arrays, and afterwards I'm using them with a FOR...NEXT cycle. This is the
 code I'm using:

 visszhang = DBconX.Exec(quert)
 FOR EACH visszhang
 nev.Add(visszhang!FName)
 ut.Add(visszhang!FPath)
 nagy.Add(Round(visszhang!FSize / 1048576, -2))
 mikor.Add(visszhang!FChanged)
 kotet.Add(point)
 NEXT
 dis = nev.Count
 gV.Rows.Count = dis
 FOR i = 0 TO dis - 1
 gV[i, 0].Text = nev[i]
 gV[i, 1].Text = kotet[i]
 gV[i, 2].Text = ut[i]
 gV[i, 3].Text = nagy[i]
 gV[i, 4].Text = mikor[i]
 NEXT

 But like this it takes eternity to create a table of 17.000 rows. There is
 a remark in Gambas documentation:
 * You should use the last
 methodfile:///usr/share/gambas2/help/help/def/method.htmlif you have
 thousands of rows to display.
 *What does it exactly mean? Can you recommend me a faster algorithm?
 Thanks!

You must do exactly what is written in the documentation: instead of setting 
the data explicitely, you must implement the Data event handler. In this 
event handler, you will receive the Row and Column of the cell to fill, and 
in return you set the properties of the GridView.Data property to define the 
cell contents.

PUBLIC SUB MyGridView_Data(Row AS Integer, Column AS Integer)

  MyGridView.Data.Text = Row   :   Column

END

-- 
Benoit Minisini

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user