Re: Button colour changes

From: Date: Tue, 04 Feb 2003 06:24:42 +0000
Subject: Re: Button colour changes
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-3005@lists.php.net to get a copy of this message
I'm sorry, either you've badly misunderstood style or I've badly misunderstood you :) Take another look at GtkStyle and GtkStateType. GTK_STATE_PRELIGHT means the widget is in focus. If that focus is gone and the widget remains sensitive, the state is GTK_STATE_NORMAL. The colours on a button are set according to the GtkStateType... whether you changed that state's colour or not :) ----- Original Message ----- From: "Dan Harper" <dharper@dadirect.com.au> To: <php-gtk-general@lists.php.net> Sent: Tuesday, February 04, 2003 1:12 AM Subject: [PHP-GTK] Button colour changes > 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 > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.gtk.general (#3005) next »