Re:Background of Drawarea (in Viewport)



I reply to myself ... I found the mistake, I forgot to put
area.show(); ...

And i can have now a result, but i have still an error ... I
want to draw on my widget an arc, but with this new code a
SEGFAULT is thrown ...

MyComponent::MyComponent() {
	set_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK |
Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
	area.set_size_request(600,400);
	add(area);
	area.show();
	area.modify_bg(Gtk::STATE_NORMAL,Gdk::Color("white"));

	Glib::RefPtr<Gdk::GC> blackgc = area.get_style()->get_black_gc();
	area.get_window()->draw_arc(blackgc,false,100,100,20,20,0,23040);
}

Olivier

> Hi,
>
> I try to find what is the problems but I don't find ...
> I would like to have a white background in my Drawarea widget
> but i don't manage ...
>
> That is my source code :
>
> MyComponent::MyComponent() {
>         set_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK
> | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
> 	area.set_size_request(800,800);
> 	add(area);
>
>         Glib::RefPtr<Gdk::Window> window = area.get_window();
> 	window->set_background(Gdk::Color("white"));
> 	window->clear();
> }
>
>
> MyComponent inherent Gtk::Viewport
> area = Gtk::Drawarea
>
> This code through a SEGFAULT on the line
> "window->set_background(Gdk::Color("white"));".
>
> Thanks in advance
>
> Accédez au courrier électronique de La Poste : www.laposte.net ;
> Jusqu'au 25 décembre, participez  au grand jeu du Calendrier
de l'Avent et
>  gagnez tous les jours de nombreux lots, + de 300 cadeaux en
jeu !
>
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>

-----------------------------
MARTIN Olivier, webmaster de :
http://www.codeur.org/
http://www.codeur.org/~perso/

Accédez au courrier électronique de La Poste : www.laposte.net ;
Jusqu'au 25 décembre, participez  au grand jeu du Calendrier de l'Avent et
 gagnez tous les jours de nombreux lots, + de 300 cadeaux en jeu !






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