/* * Win3 * ---- * This program creates three windows, demonstrating how to correctly * use the newwindow and show functions. */ #include window w, w1, w2; void show_window_1 (button b) { show(w1); /* do whatever else is needed when showing window 1 */ } void show_window_2 (button b) { show(w2); /* do whatever else is needed when showing window 2 */ } void close_window_1 (button b) { hide(w1); /* do whatever else is needed when hiding window 1 */ } void close_window_2 (button b) { hide(w2); /* do whatever else is needed when hiding window 2 */ } void quit(button b) { /* do whatever is needed when exiting the program */ exitapp(); } void main(void) { w = newwindow("Control Panel", rect(10,20,300,130), StandardWindow); newbutton("See window 1", rect(10,10,180,30), show_window_1); newbutton("See window 2", rect(10,50,180,30), show_window_2); newbutton("Quit", rect(10,90,180,30), quit); show(w); w1 = newwindow("Window 1", rect(330,20,300,250), StandardWindow); newbutton("Close", rect(10,10,80,30), close_window_1); w2 = newwindow("Window 2", rect(10,190,300,250), StandardWindow); newbutton("Close", rect(10,10,80,30), close_window_2); mainloop(); }