Re: settting the background and foreground



El Jan 10, 2011, a las 4:32 PM, "Charles Seedle" <charles seedle rigaku com> escribió:

I am tring to set the background and foreground of my main window. Is there a good example of how to do this out there ?

I keep getting the messeges:

 

 

(Hello:22855): Gdk-CRITICAL **: gdk_gc_new: assertion `drawable != NULL' failed

 

(Hello:22855): Gdk-CRITICAL **: gdk_gc_set_foreground: assertion `GDK_IS_GC (gc)' failed

 

(Hello:22855): Gdk-CRITICAL **: gdk_gc_set_background: assertion `GDK_IS_GC (gc)' failed

 

(Hello:22855): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

 

 

From this code:

  Glib::RefPtr<Gdk::Window> win = get_window();

 

  Glib::RefPtr<Gdk::GC> some_gc = Gdk::GC::create(win);

  Glib::RefPtr<Gdk::Colormap> some_colormap = get_default_colormap();

  set_decorated(false);

 

  my_gray.set_red(0xc900);

  my_gray.set_green(0xca00);

  my_gray.set_blue(0xc800);

 

  some_colormap->alloc_color(my_gray);

  some_gc->set_foreground(my_gray);

 

  my_blue.set_red(0x0000);

  my_blue.set_green(0x7200);

  my_blue.set_blue(0xc800);

 

  some_colormap->alloc_color(my_blue);

  some_gc->set_background(my_blue);


When getting the window of a widget, you have to be sure it is realized first.  See Gtk::Widget::signal_realize().  Or maybe use one of the Gtk::Widget::modify_* methods.

 

 

 

 

Randy

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


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