Re: GtkDrawingArea color problem ;)



Message: 5
Date: Fri, 18 Nov 2005 15:41:45 -0600
From: Bob Caryl <bob fis-cal com>
Subject: Re: GtkDrawingArea color problem ;)
To: congo imafexbb sk
Cc: gtkmm-list gnome org
Message-ID: <437E4A99 9070004 fis-cal com>
Content-Type: text/plain; charset="iso-8859-2"

Derive your own drawingArea from Gtk::DrawingArea and Gtk::Window::add
to your derived window class.  Set your drawingArea's  background color
in its constructor.  Create or load your images where you will, but put
code into your derived drawingArea's on_expose_event method that acesses
those images and does the rendering in that method.

Bob Caryl

I don't know if you'll get this Jan, but if you're still having problems with the background and Bob's suggestion doesn't help, I can tell you what I did to fix the problem I had (I still have to place it on the list).

First:
Try placing the get_window()->set_background(Gdk::Color) command in the on_realize() function. I don't think you can set window properties until on_realize().

Second:
Make sure that only one object of the class is created. I called a second constructor from a default one since I needed some options passed to it, but didn't want to rewrite the class.

Anyways, the first object was created, my values were placed into it and then a copy was made, from a default object, without my values or functions run from the constructor, and the first one was deleted and the copy was renamed to the origional.

Summation: All of my values from the constructor disappeared and I had to re-insert them later by rewriting the class.

Third:
Create your object as a private member of your base class, not in one of the functions of the class. I had more wierd problems with this, specifically with regards to background color.

    --Jeff Robins

PS:  Sorry for the length, especially if this has been solved.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]