Re: Error when executing my app



Carlos Pereira <carlos pehoe civil ist utl pt> writes: 
1) when you show_all your widgets you are giving away
the fin control that you have when explicitly showing
each widget at a time. You always know better what
and when to show than gtk possibly can. Sometimes
you specifically want to show some widgets and hide
others and gtk_widget_show_all cannot handle this. 
(For example, the way to get variable size notebooks
is to hide the content of all pages and then show only
the current one. With gtk_widget_show_all (window), gtk 
will show all pages and the size gets wrong).

So just don't use show_all() if you are hiding some widgets - this is
pretty intuitive. ;-)

2) There is at least one case where the widget should 
not be shown (the menu widget). I don't know if 
gtk_widget_show_all can handle this well.

It handles it properly.

3) There might be cases where the order used to show 
the widgets and to connect signals might be important. 
Usually you want the window to be shown in the end so
everything pops up at once. Probably gtk_widget_show_all
does this as well, but you are not really in control...
you could want it the other way around...

show_all always shows the toplevel last, which is always what you
want.

4) Sometimes using gtk_widget_show_all, sometimes
using gtk_widget_show, just adds to confusion. When
you see the code of someone else, you never know
if he forgot a gtk_widget_show instruction or he added
a gtk_widget_show_all instruction 300 lines further down.

Unless you always use show_all() for consistency...

4) Last but not the least, all the examples that come with 
gtk, made by those who know better, never use gtk_widget_show_all.

Because show_all() didn't exist when the examples were written. ;-)

Havoc




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