# Control

### Main Loop

IUP is an event-oriented interface system, so it will keep a loop "waiting" for the user to interact with the application.
For this loop to occur, the application must call the IupMainLoop() function, which is generally used right before IupClose().
When the application is closed by returning IUP_CLOSE in a callback, calling IupExitLoop() or by hiding the last visible dialog, the function IupMainLoop() will return. Note that any CLOSE_CB is not invoked.
The IupLoopStep() and the IupFlush() functions force the processing of incoming events while inside an application callback.
The following routines are used to control startup, shudown, and everything inbetween:

IupOpen | - | Initialise IUP
IupClose | - | Shutdown IUP
IupShow | - | Displays a dialog.
IupShowXY | - | Displays a dialog in a given position on the screen.
IupSetFocus | - | Sets the interface element that will receive the keyboard focus.
IupHide | - | Hides an interface element.
IupPopup | - | Show a dialog or menu, equivalent of a modal dialog is some toolkits.
IupMap | - | Creates (maps) the native interface objects corresponding to the given IUP interface elements.
IupMainLoop | - | Start the event processing loop/user interaction
IupClipboard | - | Creates an element that allows access to the clipboard.
IupTimer | - | Creates a timer
IupRecordInput | - | Records all mouse and keyboard input in a file for later reproduction.
IupPlayInput | - | Reproduces all mouse and keyboard input from a given file.
IupConfig | - | Initialise configuration file handler.
IupHelp | - | Opens the given URL.

Note that IupThread() is not supported (since it would not have a proper call stack).
THREAD_CB should be translated to create_thread()or task_create().
START should be translated to resume_thread() or task_schedule().
EXIT should be translated to exit_thread() a simple return.
ISCURRENT should be translated to get_thread_id() or task_self().
YIELD should be translated to suspend_thread() or task_yield().
JOIN should be translated to wait_thread() (or "", which may be completely unnecessary).
LOCK should be translated to enter_cs() and/or leave_cs() (unnecessary under multitasking).