show/hide widget within other widget



If you expected the user works with the calendar I think you can create it
at start up.

If using the calendar is not usual, maybe you could delay the creation and
when the user enables it, create the calendar and place it in your window.

Creating all widgets at start up is faster for you.. but if you planned to
show only one at a time, it is quite inefficient.

---------- Forwarded message ----------
From: Andreas Kotowicz <kotoml mynetix de>
Date: 04-abr-2006 19:36
Subject: show/hide widget within other widget
To: gtk-app-devel-list gnome org

I have a main.c file like this:

int main(int argc, char **argv)
{
  GnomeProgram *program;

  program = gnome_program_init(bla, bla, ..)
  create_mainwindow();
  gtk_main();
  return 0;
}

where create_mainwindow reads like following:

void create_mainwindow (void)
{
  GnomeApp *window;
  window = create_ui();
  GtkWidget *calendar;
  calendar = create_calendar();
  gnome_app_set_contents(window, GTK_WIDGET(calendar));

  gtk_widget_show_all(GTK_WIDGET(window));
}

as you may guess, create_ui just sets up the window with menu and tool
bars, etc.
create_calendar creates a gtkcalendar.

Now in my create_ui function I have a menu option for enabling/disabling
the calendar. as the calendar is enabled by default, how should I now
disable (maybe hide) it? what's the most elegant solution for this
problem? I also think about the possibility to choose from a variety of
widgets to be displayed inside the contents window. and in my eyes it
doesn't make sense to first create all those widgets and then manually
show/hide them as needed (suppose I just want to have one widget at a
time).

I'm welcome for any suggestions,
cheers,
Andreas

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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