blocking window



Hello,

I'm about writing a program which allows the user to save some
data. I'm looking for a simpler method than I the one I'm using
at the moment:

file_save ()
 ... creates a file_selection window.
     If the user press OK/Cancel, file_save_ok () is called
     
file_save_ok ()
 ... if the selected file does not exist, file_save_ok_ok ()
     is called
 ... if the selected file exists, a message box appears and
     asks whether the file shall be overriden. After Yes/No,
     file_save_ok_ok () is called
     
file_save_ok_ok ()
 ... if the file exists and shall be overriden or if the file
     did not exist, finally it can be saved.


Now, I'm looking for a simpler method for doing this - something
like a blocking window, demonstrated by the following pseudo
code:

file=open_file_window ();
if file_exists (file)
   if !file_shall_be_overriden() return;
// now save the file

The major advantage is that I do not need three function for
such a small task and it would also avoid the globally holding
of the filename.

Has anyone an idea? Or does everybody this with three functions?


Thanks a lot for your help.

-- 
 _____  _   _  _____
(  _  )( ) ( )(  _  )                       PENGUINS ARE COOL
| (_) || |/'/ | (_) |
|  _  || , <  |  _  | ---------------------------------------
| | | || |\ \ | | | | andre.karwath@informatik.tu-chemnitz.de
(_) (_)(_) (_)(_) (_)          http://www.tu-chemnitz.de/~aka



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