Function droom_ui::with_iup [] [src]

pub fn with_iup<F: FnOnce() -> Result<(), String>>(f: F)
                                                   -> Result<(), InitError>

Initializes IUP toolkit, calls f for user initialization and runs the application.

All IUP-Rust functions, objects and methods must be used within the bounds of the f closure. Such closure must return a Result indicating whether the user initialization was successful.

This function will return only after the GUI application is closed.

Returns Ok if the IUP initialization and user initialization were successful. Err otherwise.

Notes

Blocking

This functin will not return until until a callback returns CallbackReturn::Close, IupExitLoop (TODO) is called, or there are no visible dialogs.

If the f closure returns successfully without any visible dialogs and no active timers, the application will hang and will not be possible to close the main loop. The process will have to be interrupted by the system.

When the last visible dialog is hidden the IupExitLoop (TODO) function is automatically called, causing this function to return. To avoid that set LOCKLOOP=YES before hiding the last dialog.

Enviroment Variables

The toolkit's initialization depends also on platform-dependent environment variables, see each driver documentation.

  • QUIET: When this variable is set to NO, IUP will generate a message in console indicating the driver’s version when initializing. Default: YES.
  • VERSION: When this variable is set to YES, IUP generates a message dialog indicating the driver's version when initializing. Default: NO.