X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e306597309a120f2ae91385c731a5cb2722c52aa..455df0f4503a447b14b26fa6bfd9f408c5ae236e:/docs/latex/wx/tdelwin.tex diff --git a/docs/latex/wx/tdelwin.tex b/docs/latex/wx/tdelwin.tex index 4600573cd4..7d7b02a1b1 100644 --- a/docs/latex/wx/tdelwin.tex +++ b/docs/latex/wx/tdelwin.tex @@ -3,7 +3,7 @@ Classes: \helpref{wxCloseEvent}{wxcloseevent}, \helpref{wxWindow}{wxwindow} Window deletion can be a confusing subject, so this overview is provided -to make it clear when and how you delete windows, or respond to user requests +to help make it clear when and how you delete windows, or respond to user requests to close windows. \wxheading{What is the sequence of events in a window deletion?} @@ -17,7 +17,7 @@ decide whether or not to destroy the window. If the application is for some reason forcing the application to close (\helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns FALSE), the window should always be destroyed, otherwise there is the option to ignore the request, or maybe wait until the user has answered a question -before deciding whether it's safe to close. The handler for EVT\_CLOSE should +before deciding whether it is safe to close. The handler for EVT\_CLOSE should signal to the calling code if it does not destroy the window, by calling \helpref{wxCloseEvent::Veto}{wxcloseeventveto}. Calling this provides useful information to the calling code. @@ -27,6 +27,10 @@ delete the window, and not use the {\bf delete} operator. This is because for some window classes, wxWindows delays actual deletion of the window until all events have been processed, since otherwise there is the danger that events will be sent to a non-existent window. +As reinforced in the next section, calling Close does not guarantee that the window +will be destroyed. Call \helpref{wxWindow::Destroy}{wxwindowdestroy} if you want to be +certain that the window is destroyed. + \wxheading{How can the application close a window itself?} Your application can either use \helpref{wxWindow::Close}{wxwindowclose} event just as @@ -45,7 +49,7 @@ The default close event handler for wxDialog simulates a Cancel command, generating a wxID\_CANCEL event. Since the handler for this cancel event might itself call {\bf Close}, there is a check for infinite looping. The default handler for wxID\_CANCEL hides the dialog (if modeless) or calls EndModal(wxID\_CANCEL) (if modal). -In other words, by default, the dialog is not destroyed (it might have been created +In other words, by default, the dialog {\it is not destroyed} (it might have been created on the stack, so the assumption of dynamic creation cannot be made). The default close event handler for wxFrame destroys the frame using Destroy(). @@ -66,7 +70,7 @@ the exit command altogether. \wxheading{What should I do to upgrade my 1.xx OnClose to 2.0?} -In wxWindows 1.xx, the {\bf OnClose} function did not actually delete 'this', but signalled +In wxWindows 1.xx, the {\bf OnClose} function did not actually delete 'this', but signaled to the calling function (either {\bf Close}, or the wxWindows framework) to delete or not delete the window.