[gtkmm] configure_event in drawing area



Hello

It seems like the on_configure_event in a widget is not called until the widget becomes visible on the screen. For example, if I put a widget in a notebook the configure event wont be called until I open the page where the widget is packed.

This is a problem in my program GSpeakers (http://gspeakers.sf.net). I have a number of drawingareas inserted in a notebook. I also have a lot of drawing initialization in the configure event:

bool MyDrawingarea::on_configure_event(GdkEventConfigure* event)
{
  m_refPixmap = Gdk::Pixmap::create(get_window(), get_allocation().width, get_allocation().height, -1);
  m_refGC = get_style()->get_fg_gc(get_state());
  m_refColormap = m_refGC->get_colormap();
  white = Gdk::Color("white");
  black = Gdk::Color("black");
  m_refColormap->alloc_color(white);
  m_refColormap->alloc_color(black);
  Glib::RefPtr<Pango::Context> refPangoContext = get_pango_context();
  m_refLayout = Pango::Layout::create(refPangoContext);
  redraw();
  return true;
}

I need to draw to the window before a user choose to view it. Is there a way to do this init earlier? If I try to init the pixmap in the ctor it segfaults...

Regards

Daniel Sundberg
dss home se
http://gspeakers.sf.net



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