changing button colours
- From: Bill Purvis <bill p bigfoot com>
- To: gtk-list gnome org
- Subject: changing button colours
- Date: Fri, 27 Oct 2000 09:06:36 +0100
Hi, I have been programming gtk+ for a while now, but I'm having
problems changing the background colour of widgets - specifically
buttons, but that's probably not relevant. I need to be able to
change the colours when the buttons have been pressed. Is there
a recommended way of doing this?
At present I simply overwrite the widget->style->bg_gc[] entry
and this works fine until I close things down when I get a
segmentaion violation in gtk_gc_key_hash (from gtk_gc_release),
so I assumed that I needed to take into account the reference
counts. I changed my code as follows:
gdk_gc_unref(widget->style->bg_gc[0]);
gdk_gc_ref(mygc);
widget->style->bg_gc[0] = mygc;
My reasoning was that the old gc was no longer needed here,
so it could be unreffed, and the new one had its count bumped.
This was worse than ever - the program segfaults immediately on
starting up, in XSetClipRectangle. Am I doing something absolutely
stupid here? I've tried scanning the FAQ, the Tutorials and the
source code and haven't (as yet) found any clue as to what I
ought to be doing.
Many thanks in advance,
Bill
--
+-----------------------------------------------+
| Bill Purvis, Musical Engineer |
| 35 Chapel Road, Penketh, Warrington, Cheshire |
| WA5 2NG. phone: 01 925 725731 |
| e-mail: bill p bigfoot com |
| www: http://bil.members.beeb.net |
+-----------------------------------------------+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]