Re: [gtk-list] deleting widgets
- From: Tim Janik <timj psynet net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] deleting widgets
- Date: Sun, 10 Aug 1997 17:28:41 +0200 (CEST)
On 10 Aug 1997, Jeff wrote:
>
> ok, this may be a fundamental widget set question that I should know,
> but this is pretty much my first widget set programming experience
> (im usually raw xlib with a tad of athena).
>
> once I define a window, put in a menubar, have a bunch of widgets taking
> up areas of the window, how do I 'delete' those widgets so that I can
> put other ones in their place? lets say the program starts, the whole window
> is dedicated to a GtkImage for a title screen, then i want the GtkImage
> to go away, and some other widgets to replace it.....
hm, i still consider my solution to this somewhat unelegant,
but anyways:
i had the same problem in GUBI, because GUBI doesn't currently support a
nootebook widget, i'm using several v_boxes within one window that i need
to (dis-)appear on demand (button click).
here is the function i connected to the button:
> void
> SigH_Editor_Expand_clicked (GtkWidget *widget,
> GtkWidget *Box)
the box to show/hide is passed as user_data to the signal handler
> {
> register GtkWidget *parent;
>
> g_assert(widget);
> g_assert(Box);
>
> if (GTK_TOGGLE_BUTTON(widget)->active)
> gtk_widget_show(Box);
and here the box acutaly gets hidden, but leaves an ugly big nothing in it's
place, because the main window doesn't get resized automaticaly.
> else
> gtk_widget_hide(Box);
>
> parent=Box->parent;
> do {
> parent=parent->parent;
> } while (parent->parent);
so from the box on i step upward until i find the topmost widget of the
hirarchy, which must be the main window
>
> gtk_widget_set_usize(parent, -1, -1);
> gtk_widget_set_usize(parent, 0, 0);
this was the only way to make the window perform a total size recalculation.
> }
you could also instead of hiding just destroy (gtk_widget_destroy) the widget
you want to dissapear, but you still need to force the resize. and you
certainly can't show it again ;)
BTW: the lack of a notebook widget in GUBI is really getting on my nerves,
i'll try to find some time for that this week!
>
> Jeff
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]