WindowClose

HC GUI programming Windows A-F WindowClose
WindowClientToScreen WindowDestroy

bool WindowClose Window
bool (WindowClose Window force)


This function simply generates a wxCloseEvent whose handler usually tries to close the window. It doesn't close the window itself, however.

Parameters

force: false if the window's close handler should be able to veto the destruction of this window, true if it cannot.

Remarks: Close calls the close handler for the window, providing an opportunity for the window to choose whether to destroy the window. Usually it is only used with the top level windows (wxFrame and wxDialog classes) as the others are not supposed to have any special OnClose() logic.

The close handler should check whether the window is being deleted forcibly, using wxCloseEvent::CanVeto, in which case it should destroy the window using wxWindow::Destroy.

Note that calling Close does not guarantee that the window will be destroyed; but it provides a way to simulate a manual close of a window, which may or may not be implemented by destroying the window. The default implementation of wxDialog::OnCloseWindow does not necessarily delete the dialog, since it will simply simulate an wxID_CANCEL event which is handled by the appropriate button event handler and may do anything at all.

To guarantee that the window will be destroyed, call wxWindow::Destroy instead.

WindowClientToScreen WindowDestroy