Re: Bug clist set_*color
| From: | Ivan Rodriguez | Date: | Mon, 01 Dec 2003 12:03:19 +0000 |
| Subject: | Re: Bug clist set_*color | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4261@lists.php.net to get a copy of this message | ||
To altern the color of cells you can do this:
function _getClients() {
$lista_colores = array('#f5f1ea','#ffffff');
$this->widget['clients'] -> clear();
$SQL = "SELECT nombre FROM clientes";
$datos = $this->dikode -> getDatos($SQL);
$i = 0;
foreach($datos as $dato) {
$foco = $this->widget['clients'] -> insert_node(NULL, NULL,
array($dato[18]), 5, null, null, null, null, false, false);
$style =& new GtkStyle();
$color = $lista_colores[$i % count($lista_colores)];
$style -> base[GTK_STATE_NORMAL] = new GdkColor($color);
$this->widget['clients'] -> node_set_cell_style($foco, 0, $style);
$i++;
}
}
You can alter using GtkStyle and the method node_set_cell_style
Regards Ivan.
----- Original Message -----
From: "Yann Larrivee" <yannl@istop.com>
To: <php-gtk-general@lists.php.net>
Sent: Monday, December 01, 2003 3:41 AM
Subject: [PHP-GTK] Bug clist set_*color
> Hi, i am trying to set the background / foreground color of clist
> elements.
>
> It will not work this way.
>
> for ($i=1;$i<100;$i++) {
>
> $color = &new GdkColor(0, 65535, 65535);
>
> $clist->set_foreground($i,$color);
> $row[0] = 'something';
>
> $clist->append($row);
> }
>
>
> But it will work if i set only row number by hand
>
> $clist->set_foreground(1,$color);
>
> So it is basicly impossible to alternate color dynamicly.
>
> Does anybody has a solution ?
>
>
> Thanks for the help
>
> Yann
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>