Luckily, SWHX provides the useful onClose method, which is called the moment a window handled by
the SWHX layer is closed. By overriding this method, one could easily ensure that all important
connections to external resources are safely closed, and all allocated memory is released. The onClose
method expects a return value of type Bool ; by returning true , the window is safe to close, while false
forces the window to remain open.
swhx.Application.loop is exited the moment all windows are closed, allowing any code that
follows the loop to be run. When building an application utilizing only one window, it pays to be safe
with regard to how the application cleans up after itself by putting all cleanup code inside the
onClose method.
onMinimize and onMaximize Events
The onMinimize and onMaximize methods are, surprisingly, called whenever the window is either
minimized or maximized. These event handlers can be useful if you wish to halt a part of the application
if the window is minimized, and to restart when maximized.
Pages:
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957