[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: Re:Background of Drawarea (in Viewport)
From:       Paul Davis <paul () linuxaudiosystems ! com>
Date:       2005-12-29 22:41:53
Message-ID: 1135896113.4661.36.camel () localhost ! localdomain
[Download RAW message or body]

On Thu, 2005-12-29 at 21:29 +0100, olivier_martin wrote:
> 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);
> }

lets repeat the mantra again:

	Users of X Window based toolkits: draw only in response to 
        expose events. Draw *only* in response to expose events.

You have two specific problems in the code above:

	a) the area has no Gdk::Window until it has been realized,
	   which occurs at a point in time that you have no
	   control over.

	b) you should draw into an on-screen drawable (like the 
           Gdk::Window) only from an expose event handler.

--p


_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic