Button colour changes
| From: | Dan Harper | Date: | Tue, 04 Feb 2003 01:12:31 +0000 |
| Subject: | Button colour changes | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-3003@lists.php.net to get a copy of this message | ||
I'm new to the list and GTK programming, and I am having trouble with
changing colours on buttons.
Basically, I've got a row of buttons (0-4), when a user clicks on a
button, it changes to a highlight colour, while the button that was
pressed previously to that restores to the original button colour
(un-highlighted).
This is my code when a button is clicked:
$Style = &new GtkStyle();
$WidgetName = "PL".$ButtonLabel."Button".$ButtonClicked;
$PLButton = $PLWindow->get_widget($WidgetName);
$Style->color = $Colors["Selected"];
$Style->color = $TestColor;
$PLButton->set_style($Style);
And this is the code I've written to de-activate the last button
pressed:
$UnselectedStyle = new GtkStyle();
$WidgetName =
"PL".$ButtonLabel."Button".$DeptData["DeptSelected"];
$PLButton = $PLWindow->get_widget($WidgetName);
$UnselectedStyle->color = $Colors["Unselected"];
$PLButton->set_style($UnselectedStyle);
The problem is, once the button has changed colours once, it seems I
can't change the colour a second (or more) time.
Is there anything I'm doing wrong?
Thanks,
Dan