[Glade-users] libglademm and DrawingArea
Michael Kleiber
mike@kleibi.de
Sat, 05 Mar 2005 13:58:27 +0100
> So why is my graphics context = NULL although I implemented the
> on_realize function just as in the tutorial?:
> void GCurveDrawingArea::on_realize()
> {
> // We need to call the base on_realize()
> Gtk::DrawingArea::on_realize();
>
> // Now we can allocate any additional resources we need
> Glib::RefPtr<Gdk::Window> window = get_window();
> gc_ = Gdk::GC::create(window);
> window->set_background(red_);
> window->clear();
> gc_->set_foreground(blue_);
> std::cout << "Drawing Area realized!" << std::endl;
> }
Ok - I found the problem myself - the on_realize function is not called!
Why?? The drawing works as it is supposed to now but where would I do
the initialization of the GC if not in the on_realize method?