IupClose

Definition: include pGUI.e

IupClose()
Description: Shutdown IUP
Comments: This procedure should be called at the end of the program.

See also IupOpen, which should be called at the start of the program.

While I am currently unaware of any consequences of forgetting to invoke IupClose, I would never deliberately not.
Utility Routine The following procedure can also be used (much nearer the start) to assign a standard escape key handler to the main dialog:

IupCloseOnEscape(Ihandle dlg)

This is implemented as and therefore behaves identially to declaring and using the following callback:

function key_cb(Ihandle /*dlg*/, atom c)
    return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE)
end function
IupSetCallback(dlg, "K_ANY", Icallback("key_cb"));

Note that secondary dialogs may need to invoke IupHide() rather than using IUP_CLOSE, since that terminates the entire application, unless there are nested IupMainLoop() calls.

Obviously, should you need any other key handling then take a copy of that and modify it, instead of invoking IupCloseOnEscape().

In truth, IupCloseOnEscape has almost nothing to do with IupClose and must not be considered a substitute or replacement for it.
Example:
include pGUI.e

IupOpen()
Ihandle main_dialog = IupDialog(IupLabel("Hello","PADDING=80x10"),"TITLE=test")
IupCloseOnEscape(main_dialog)
IupShow(main_dialog)
IupMainLoop()
IupClose()
See Also: IupOpen, IupMainLoop, IupSetCallback, Icallback, K_ANY, IupHide