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



> 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





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