[Gambas-user] celdas de listview

Doriano Blengino doriano.blengino at ...1909...
Sun Nov 16 09:45:12 CET 2008


jjmoncar ha scritto:
> buenas noches.
>
> estoy tratando de hacer una aplicacion con el listview de manera que cuando
> se haga click en una celda esta cambie de color. el siguiente codigo lo
> hace, pero me cambia el color de ambas celdas. espero me puedan ayudar.
>   
Uhm, I think you should write in English to this list...

The following code is strange:
> PUBLIC SUB TableView1_Click()
> 'aqui se supone que si hago clic en la celda [0,2] le debe cambiar el color
> IF TableView1[0, 2] THEN
>   TableView1[0, 2].BackColor = &0000FF&
> ENDIF
> IF TableView1[0, 2] THEN
>   TableView1[0, 1].BackColor = &FFFF00&
> ENDIF
>
>   
First, you have a test in "Tableview1[0,2]". This expression returns an
object, so it is almost always true.
Then, you do two identical tests, so one of them should be enough.

I would write:

PUBLIC SUB TableView1_Click()
IF TableView1[LAST.Row, Last.Column].BackColor=&hFF THEN
  TableView1[LAST.Row, Last.Column].BackColor = &hFFFF00
else
  TableView1[LAST.Row, Last.Column].BackColor = &hFF
ENDIF
END

This code alternates between two colors.

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