RE: [AD] [DOCS] set_window_close_hook |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
> Who is responsible for writing what is hopefully the only > self-contradictory > item in the docs ? ME!!!!!!!!!!! Patch attached. Also quoted below. Before committing, can we confirm that what I said about kill boxes is actually true? Thanks, Ben -- --- allegro._tx Sat Jun 22 07:27:32 2002 +++ allegro._tx.new Sat Jun 22 07:39:28 2002 @@ -203,21 +203,25 @@ Note that Allegro cannot manipulate the close button of a DOS box in Windows. -@domain.hid @set_window_close_hook(void (*proc)()); +@@void @set_window_close_hook(void (*proc)(void)); @xref set_window_close_button, set_window_title, get_config_text @xref three_finger_flag On platforms that have a close button, this routine installs a hook function to handle the close event. In other words, when the user clicks the close button on your program's window, the function you specify here - will be called. You can use this function to display a box offering to - save data or checking that the user really wants to exit, or you can use - it just to save config data, free memory and exit. + will be called. In this case the program will not be forced to exit, so + you are responsible for exiting if desired when the button is pressed + (see below). Note that this is not true on some windowing systems; if you + click a kill box, your program will exit come what may, and this function + will not be called. - This function should not generally attempt to exit the program or save - any data itself. The function could be called at any time, and there is - usually a risk of trying to save when the data are invalid. Instead, you - should set a flag during this function, and test the flag on a regular - basis in the main program. + You may wish to display a box offering to save data or checking that the + user really wants to exit, or you may just like to save config data, free + memory and exit. Note, however, that you should not generally do anything + like this in the close hook function itself. The function could be called + at any time, and there is usually a risk of trying to save when the data + are invalid. Instead, you should set a flag during this function, and + test the flag on a regular basis in the main program. Pass NULL to this function to restore the close button's default functionality. On Windows and BeOS, the following message will appear: @@ -229,7 +233,7 @@ [Yes] [No] <endblock> - This message will be translated into your selected language if a + This message will be translated into your selected language if a translation is available in language.dat (see get_config_text()). If the user clicks [Yes], the program will exit immediately in the same
Attachment:
allegro._tx.diff.zip
Description: Binary data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |