Re: Error when executing my app



Forget gtk_widget_show_all(), you should never use it.

Why do you say that?  I use it all the time, so I'd like
to know if there's a reason to avoid it.

I might be wrong on this (that answer was for a newbie,
I could have added <i>unless you know better</i>), 
but consider these arguments:

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).

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.

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...

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.

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.

If these arguments don't convince you, just ignore
my post... :-)

Carlos




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