[Gambas-user] Table view questions

ron ronstk at ...239...
Mon Sep 13 15:29:20 CEST 2004


On Monday 13 September 2004 13:01, Eilert wrote:
> Hi Ron,
> 
> > very stupid example:
> 
> Thanks a lot, now I got it. My way of doing it now is to reset the 
> number of rows and columns to have the Data event called:
> 
> 1. Load all data e. g. into an array
> 2. Prepare the tableview with rows and columns
> 3. this will call the Data event
> 4. Fill the cells from within the Data event
> 
> Is it correct that way?
> 
> Rolf
> 

Basically seen yes.
However to update the tableview by hand, (code of course)
you can use the tableview.refresh in the code after the array is filled with data.

A good example could be Example/Database/DataReportExample  take a look in :
Thats why they exist. I learn still every time from those.
Many people do not look in it I supose. :) 
Me included mostly :( 

Fmain.class
------------

PUBLIC SUB TableView1_Data(Row AS Integer, Column AS Integer)
  'the array's field name's
  arrtable[0]="id"
  arrtable[1]="name"
  WITH Mglobal
    .rs1.MoveTo(Row)
    tableview1.data.Text = Str(.rs1[arrtable[Column]])
  END WITH
END

and Mglobal
-------------
PUBLIC SUB fill_view(tbv AS tableview, qry AS String)
DIM i AS Float
  rs1 = db.exec(qry)
  WITH rs1
    tbv.rows.count=0
    IF .count<>0 THEN
      tbv.columns.count=.fields.count
      tbv.rows.count=.count
    END IF
  END WITH
END





More information about the User mailing list