[Gambas-user] Table view questions

Eilert eilert-sprachen at ...221...
Mon Sep 13 08:54:53 CEST 2004


Hi Benoit,

This is just what I wondered about... :-)

>>First, you've got to "build" a Data event for the tableview by hand,
>>typing (when tb == tableview)
>>
>>public sub tb_Data(row as integer, column as integer)
>>
>>	'and then you have to make sure to catch the correct cell number
>>	'for example:
>>	if row = 1 and column = 1 then
>>		tb.Data.Text = "hello"
>>		tb.Data.BackColor = &H00FF00&
>>	end if
>>
>>end
>>
>>You will then have to trigger that event from somewhere else, calling it
>>
>>	tb_Data(1,1)
> 
> 
> ???? You should never call the Data event handler yourself.

I thought so - but "who" will do it for me?

>>while the values you give there are of no meaning - the tableview will
>>always read in all values for all cells at a time - but you must give
>>values because otherwise Gambas will complain.
> 
> 
> Sorry, I don't understand your sentence...

Ok, you have to call tb_Data(1,1) or tb_Data(0,0) or tb_Data(100,100) - 
not just tb_Data(). The actual values you write into the brackets don't 
matter.

When I called it for the first time, I did not have this

	if row = 1 and column = 1 then

thing there, and the tableview filled the "hello" into every cell. So I 
think, calling the Data event will fill the whole tableview at once, and 
you must make sure yourself that the values will be put into the correct 
cells by reading "row" and "column".

That means, first you make up the number of rows and columns and set the 
headers. Then you call (or let call) the Data event, and with each row 
and column called, you set Text and Color and so on.

If it is correct up to here, the only remaining question is: how to call 
the Data event?

But it is rather unusual and I feel it is not the way you want it to be 
used... Now, am I really so stupid? I don't find another way of putting 
my texts and colors into it.

Regards

Rolf






More information about the User mailing list