[Gambas-user] TableView control, howto edit cells?

Doriano Blengino doriano.blengino at ...1909...
Sat Apr 4 08:38:48 CEST 2009


Isaac Buch ha scritto:
> Hello list,
>
> I am a newbee in gambas trying to use TableView control to allow user to 
> modify data on cells by clicking on it. 
>
> I tried to move to a row&column and modify the tableview.current.text, (that 
> works fine in a button click event) but not in the tableview_save event (Null 
> object error).
>
> Source Code:
>
> PUBLIC SUB Button1_Click()
>   TableView1.Columns.count = 4
>   TableView1.Rows.count = 4
>   TableView1.MoveTo(1, 1)
>   TableView1.Current.Text = "TEST"
> END
>
> PUBLIC SUB TableView1_Click()
>  TableView1.Edit
> END
>
> PUBLIC SUB TableView1_Save(Row AS Integer, Column AS Integer, Value AS String)
>   TableView1.MoveTo(Row, Column)
>   TableView1.Current.Text = Value		
> END
>
> Any suggestion ?
>   
I think that you, in Button1_Click(), should use something like:

    TableView1[1,1].text = "TEST"

It is more simple and clean than using MoveTo(). Moreover, I am not 
sure, but if you use MoveTo() inside a Save event handler may be gambas 
gets confused. In the event handler you should use:

    TableView1[Row,Column].text = Value

Hope this works, I didn't try.
Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list