[gtkada] Hide before Show?
Stephen Leake
stephen_leake at acm.org
Thu Jan 22 04:41:15 CET 2004
"Marc A. Criley" <m.criley at earthlink.net> writes:
> Stephen Leake writes (excerpted):
>
> > 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.
>
> For me, I've always wanted all the widgets in a window dialog displayed,
> that's why I put them in there. This latest experience is the first time
> I've ever wanted to sometimes have one hidden. I'd figured that since I
> could set sensitivity, a GEntry's initial text, and so on, I'd be able to
> preset the visibility of a widget as well.
You can; that's exactly what "show" does!
> Perhaps a better name than "Set_Visible" for such a function is
> "Set_Visibility"?
"show" is "Set_Visible (True)", "hide" is "Set_Visible (False)".
Your Set_Visible has the same problem as "show"; you have to set it
for each widget.
Perhaps you simply want the default to be visible, as opposed to not
visible?
> > Sounds like a Glade issue to me; it's not putting in the calls to
> > "show" that it should.
>
> Now perhaps I'm mistaken here, but I think I recall reading something that
> if you use a sequence of Show calls that you might end up "watching the GUI
> being constructed"; versus a Show_All where the whole thing pops onto the
> display at once.
To get all displayed at once, you do "show" from the bottom up; call
"show" on the top level window last. That happens naturally if you
call "show" right after calling "Gtk_New"; the last "show" will be on
the top level window.
> My GUIs tend to have a lot of post-Gtk_New tweaking done to
> them--such as setting widget sensitivities and GEntry contents--
This will be true of any GUI.
> so I like being able to construct the whole thing with a single
> Glade-generated Gtk_New call, configure it as needed, and then throw
> it up on the screen with a Show_All.
I don't use Glade; now I have another reason why :).
I still say this is a Glade bug; you aught to be able to specify the
default visibility in Glade, and that should result in a call to show
or hide right after Gtk_New. Same for other properties of widgets;
they should all be set right after Gtk_New.
--
-- Stephe
More information about the gtkada
mailing list