#include "graphapp.h"
void close_it(window w)
{
char *filename = NULL;
int result = askyesnocancel("Save changes?");
if (result == YES) {
filename = askfilesave(NULL, gettext(w));
if (filename == NULL) /* operation cancelled! */
return;
/* save the file somehow */
askok("The file was sucessfully saved.");
}
else if (result == CANCEL)
return;
hide(w);
}
void main(void)
{
window w1, w2;
w1 = newwindow("file1.txt", rect(0,0,300,250), StandardWindow);
setclose(w1, close_it);
show(w1);
w2 = newwindow("file2.txt", rect(20,20,300,250), StandardWindow);
setclose(w2, close_it);
show(w2);
mainloop();
}