On 7/21/05, Eduardo Paz <[EMAIL PROTECTED]> wrote: > Hi everyone! I'm new in using gtkmm, and I have a lot of questions. I > know it would be easy but I couldn find the solution looking at the > API. > Well, the first one is how i can color the background of a box (for > example). Here is the code I've written : > // Constructor of Gtk::Window > .... > add(box); > box.get_window()->set_bakground(..color..); > ... > I got a Sig-sev because the Gdk::Window that get_window returns is NULL. > Is another way to make this or I'm making something wrong?? > _______________________________________________ > gtkmm-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/gtkmm-list >
Where is 'box' defined? what is its type? Gtk::Box? According to the gtkmm tutorial[1], a Gtk::Box does not have a corresponding window, so calling get_window() won't return anything. Read [1] for more information. Note that even if you surround your box with an EventBox as mentioned in that chapter, your color will probably still need to be allocated (a concept that I don't completely understand yet -- if anybody has a clear description of what 'allocating a color in a colormap' actually means, i'd love to hear it.), but nevertheless, there's a chapter in the tutorial [2] on DrawingAreas that provides some examples of setting backgrounds and using colors. Hope that helps jonathon [1] http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch12.html [2] http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch14.html _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
