Three Windows

#include <stdio.h>
#include "graphapp.h"

Window *w, *w1, *w2;

void show_win_1 (Control *b)
{
  show_window(w1); /* do whatever else is needed to show window 1 */
}

void show_win_2 (Control *b)
{
  show_window(w2); /* do whatever else is needed to show window 2 */
}

void close_win_1 (Control *b)
{
  hide_window(w1); /* do whatever else is needed to hide window 1 */
}

void close_win_2 (Control *b)
{
  hide_window(w2); /* do whatever else is needed to hide window 2 */
}

void quit(Control *b)
{
  /* do whatever is needed when exiting the program */
  exit(0);
}

int main(int argc, char *argv[])
{
  App *app;

  app = new_app(argc, argv);

  w = new_window(app, rect(10,20,300,130),
                        "Control Panel", STANDARD_WINDOW);
  new_button(w, rect(10,10,180,30), "See window 1", show_win_1);
  new_button(w, rect(10,50,180,30), "See window 2", show_win_2);
  new_button(w, rect(10,90,180,30), "Quit", quit);
  show_window(w);

  w1 = new_window("Window 1", rect(330,20,300,250),
                         STANDARD_WINDOW);
  new_button(w1, rect(10,10,80,30), "Close", close_win_1);

  w2 = newwindow("Window 2", rect(10,190,300,250),
                         STANDARD_WINDOW);
  new_button(w2, rect(10,10,80,30), "Close", close_win_2);

  main_loop(app);
  return 0;
}

Notes: