Re: Gnome::Canvas my derived group won't display



On Fri, 2007-09-28 at 13:34 +0200, Martin Metzker wrote:
> Hi!
> 
> I wrote this:
> 
> class CCanvasGroup: public Gnome::Canvas::Group 
> {
> public:
> 	CCanvasGroup(Gnome::Canvas::Group&, double, double);
> protected:
>  
> private:
> 	Glib::RefPtr<Gdk::Pixbuf> whitetux;
> 	Glib::RefPtr<Gdk::Pixbuf> blacktux;
> 	Gnome::Canvas::Group m_group;
> };
>  
> CCanvasGroup::CCanvasGroup(Gnome::Canvas::Group& parent, double x, double y)
> :m_group(parent,x,y)

This is rather strange. Do you want to inherit from a group, or do you
want to have a group as member. You probably need to call the Group
constructor, maybe like this:

CCanvasGroup::CCanvasGroup(Gnome::Canvas::Group& parent, double x,
double y)
> : Gnome::Canvas::Group(parent)

> {	
> 	std::cout << "CCanvasGroup";
> 	whitetux = Gdk::Pixbuf::create_from_file(STONE_WHITE);
> 	blacktux = Gdk::Pixbuf::create_from_file(STONE_BLACK);
>  
> 	Gnome::Canvas::Pixbuf(m_group,0,0, /*(CCanvasGroupCounter++ & 1) ? whitetux:*/blacktux);
> 	Gnome::Canvas::Text(m_group,0,whitetux->get_height(),"Hello world");
> 	std::cout << " done" << std::endl;
> }
> 
> My mainwindow consists of a canvas and two buttons. One button simply places a Gnome::Canvas::Pixbuf, which works quite well. The other button is supposed to place a CCanvasGroup Object on the canvas. When i push the button i do get the output from the constructor, but nothing is displayed on the canvas. What did i forget?
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com




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