LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: Alan Kennington <ak1.linuxsa@topology.org>
  To  : LinuxSA <linuxsa@linuxsa.org.au>
  Date: Fri, 25 Jul 2003 21:40:57 +0930

Re: GTK+ question: how to set the colour of a button

On Fri, Jul 25, 2003 at 05:21:46PM +0930, Alan Kennington wrote:
> 
>     How do I set the background colour of a GTK button?
>     Or a GTK label? Or any other GTK widget?
> 


It turned out that it's quite simple to set the colour of a button in GTK+.
You just need to:

-	call an almost undocumented function to read style parameters
-	duplicate the almost totally undocumented style parameter structure
-	out of the 35 colours in this structure, choose the ones you want
	to change    [A button needs 35 colour parameters??!]
-	call another almost undocumented function to stick the modified
	parameters on some sort of "style stack"
-	make sure that the button relief is not turned off
	(turning off the relief turns off the colour too - weird!)

In Perl/Tk, you set the parameter:    -background => "green"
to make the button green.
And it's documented!
But mustn't complain. At least the GTK sources were available to wade through.
Now I understand why applications such as the gimp and ethereal sometimes
behave in clumsy ways (or at least they used to); obviously they had to
contend with the limitations of GTK+.

Many thanks to Andrew Braund for the help on this question.



I reckon a really great job experience idea would be to get all of
the unemployed in Australia to write full documentation for all
the free software in the world.
Anyway, nose to the grindstone again....

CHeers,
Alan Kennington.

-- 
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.freenode.net
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page