Package: gtk

Function gtk-dialog-run

Lambda List

gtk-dialog-run (dialog)

Arguments

dialog -- a gtk-dialog widget

Return Value

The response ID, which is a positive integer or a value of the gtk-response-type enumeration.

Details

Blocks in a recursive main loop until the dialog either emits the "response" signal, or is destroyed. If the dialog is destroyed during the call to the gtk-dialog-run function, it returns the :none response ID. Otherwise, it returns the response ID from the "response" signal emission.

Before entering the recursive main loop, the gtk-dialog-run function calls the gtk-widget-show function on the dialog for you. Note that you still need to show any children of the dialog yourself.

During the execution of the gtk-dialog-run function, the default behavior of the "delete-event" signal is disabled. If the dialog receives the "delete-event" signal, it will not be destroyed as windows usually are, and the gtk-dialog-run function will return the :delete-event response ID. Also, during the execution of the gtk-dialog-run function the dialog will be modal. You can force the gtk-dialog-run function to return at any time by calling the gtk-dialog-response function to emit the "response" signal. Destroying the dialog during the execution of the gtk-dialog-run function is a very bad idea, because your post-run code will not know whether the dialog was destroyed or not.

After the gtk-dialog-run function returns, you are responsible for hiding or destroying the dialog if you wish to do so.

Examples

Typical usage of this function might be:
(let ((response (gtk-dialog-run dialog)))
  (cond ((eq response :ok)
         (do-application-specific-something))
        (t
         (do-nothing-since-dialog-was-cancelled)))
  (gtk-widget-destroy dialog))    
Note that even though the recursive main loop gives the effect of a modal dialog, because it prevents the user from interacting with other windows in the same window group while the dialog is run, callbacks such as timeouts, IO channel watches, DND drops, etc, will be triggered during a gtk-dialog-run function call.
 

See also

*2021-12-3