2. Initialization
Germán Arias laboja lapu 4 gadi atpakaļ

2 Initialization

Before use any of IUP’s widget, function iup_open must be called to initialize the toolkit. After running the last Eiffel-IUP routine, function iup_close must be called so that the toolkit can free internal memory and close the interface system. Executing these functions in this order is crucial for the correct functioning of the toolkit. Between calls to the iup_open and iup_close functions, the application can create dialogs and display them. Eiffel-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 main_loop function, which is generally used right before iup_close.

When the application is closed by returning "IUP_CLOSE" in a callback, calling exit_loop or by hiding the last visible dialog, the function main_loop will return.

The loop_step and the flush functions force the processing of incoming events while inside an application callback.

Therefore, usually an application employing Eiffel-IUP will have a code in the root feature similar to the following:

inherit
    IUP_INTERFACE
    
root_feature
    local
        gui: IUP
        ...
    do
        gui := iup_open
        -- Create your interface
        
        gui.main_loop
        gui.close
    end