[gtkada] Hide before Show?

Stephen Leake stephen_leake at acm.org
Wed Jan 21 03:44:23 CET 2004


"Marc A. Criley" <m.criley at earthlink.net> writes:

> Stephen Leake writes:
> > Apparently you had not done a "show". The default state after Gtk_New
> > is hidden, so you need to call "show" on all the widgets that needed
> > to be shown. I guess that's why you did Show_All?
> >
> > Well, try using "show" only where you need it, rather than "show_all".
> 
> Well, I hardly want to invoke Show 50 times when I can do a single Show_All
> on the containing window that Glade has generated for me!

If Glade inserted the proper calls to Show in the first place (in
response to the Glade option box you mentioned), it would not be an issue.

In my non-Glade code, I do call "show" for every Gtk_New (unless I
don't want it shown, of course). For a while, I tried using Show_All
once, but there are always some you want hidden; it's best to document
that decision at each call to Gtk_New.

> > What would be more elegant, in your opinion?
> 
> ----------
> procedure Set_Visible
>   (Widget             : access Gtk_Widget_Record;
>    Visible            :        Boolean := True);
> 
> Controls the displayability of the widget.
> 
> If the widget has not yet been mapped to the screen, setting Visible to
> False prevents it from being displayed by a call to Show or Show_All (which
> also prevents its children from being displayed); if Visible is true it will
> be displayed as normal by a call to Show or Show_All.
>
> If the widget is being displayed, setting Visible to False is
> equivalent to invoking Hide and subsequently prevents the widget
> from being displayed until Set_Visible has been invoked with Visible
> set to True; calling this routine while the widget is displayed and
> with Visible set to True has no effect. ----------

That implies another state variable; currently there is just
"visible", now you need "not visible even if show or show_all is
called". I guess that makes sense. But I would find it confusing.

> Obviously this is a Gtk, and not GtkAda, issue.

Sounds like a Glade issue to me; it's not putting in the calls to
"show" that it should.

-- 
-- Stephe




More information about the gtkada mailing list