Re: Gtk window.show() (maybe just c++ related)



Maik Beckmann wrote:
Hi,

Please consider any foo widget with a show() method.
Why :
foo* foo1=new(foo);
foo->show();
shows the widget, but:

foo foo1;
foo.show();

does not?



I assume the code you posted is inside a constructor or GUI-arrange
function.
Consider this:

{ // enter scope
    ...
    foo* foo_ptr=new(foo);
    bar_container->add(*foo_ptr);
    foo_ptr->show();
foo foo_obj;
    bar_container->add(foo_obj);
    foo_obj.show();
    ...
} // leave scope
foo_obj will be destroyed, gtk+ can't show it because its gone.
foo_ptr is destroyed too, but the object it pointed to still lives.


MfG Maik


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

Thank you, the assumptions you made are right. Another newbie question:
Should I call delete() on each widget created with new() inside this widget1, or will widget1 do it itself when it will die?
Sorry for such a lame understanding of c++ :-)



	

	
		
___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com



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