[Gambas-user] Questions on tableview

Eilert eilert-sprachen at ...221...
Tue Dec 14 17:48:51 CET 2004


Bonsoir Fabien,

Bodard Fabien schrieb:
> Le lundi 13 Décembre 2004 13:14, Eilert a écrit :
> 
>>Hi,
>>
>>I have a tableview here, named tb. I read data from a file, 2 columns
>>and a lot of rows. When I add the data, I first determine the number of
>>columns and rows and the column width of column 2:
>>
>>tb.Rows.Count = zlr
>>tb.Columns.Count = 2
>>tb.Columns[1].Width = tb.Columns[1].Width * 2
>>
>>Now, one of them (or all of them?) calls the tb_Data event sub. My
>>question is, which one does? Do they all? Will all of them try to insert
>>data? That would be a bit unefficient, so there should be a way to
>>"allow" for data being inserted. Or is the interpreter intelligent
>>enough to look ahead and see for itself when it's time to insert data?
>>
>>Rolf
> 
> 
> The table view redraw the showed data so... the new added too...

So to make it more efficient, it's a good idea to insert an if clause 
into the tb_data procedure which asks a variable if any data should be 
inserted or not:

SUB tb_Data(...)

	if nowYouMayInsert
		[...]
		'let him insert data
	end if

END SUB

Here "nowYouMayInsert" is a boolean variable set to True or False by the 
procedure which makes the Rows and Columns etc.

Would you agree?

> and you need to have an array in the backend to know what data to draw...

Yes, of course. See next thread!

Rolf





More information about the User mailing list