#include "graphapp.h"
void close_it(window w)
{
char *filename = NULL;
int result = askyesnocancel("Save changes?");
if (result == YES) {
filename = askfilename("Save the file as:", "untitled.txt");
/* save the file somehow */
askok("The file was sucessfully saved.");
}
else if (result == CANCEL)
return;
hide(w);
}
void main(void)
{
window w;
w = newwindow("Text Editor", rect(0,0,300,250),
StandardWindow);
setclose(w, close_it);
show(w);
mainloop();
}
Notes: