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." ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user