Package: gtk

Class gtk:alert-dialog

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

buttons
The buttons property of type g:strv-t (Read / Write)
Labels for buttons to show in the alert dialog. The labels should be translated and may contain a "_" to indicate the mnemonic character. If this property is not set, then a Close button is automatically created.
cancel-button
The cancel-button property of type :int (Read / Write)
This property determines what happens when the Escape key is pressed while the alert dialog is shown. If this property holds the index of a button in the buttons property, then pressing the Escape key is treated as if that button was pressed. If it is -1 or not a valid index for the buttons array, then an error is returned. If the buttons property is nil, then the automatically created Close button is treated as both Cancel and Default button, so 0 is returned.
Default value: -1
default-button
The default-button property of type :int (Read / Write)
This property determines what happens when the Return key is pressed while the alert dialog is shown. If this property holds the index of a button in the buttons property, then pressing the Return key is treated as if that button was pressed. If it is -1 or not a valid index for the buttons list, then nothing happens. If the buttons property is nil, then the automatically created Close button is treated as both Cancel and Default button, so 0 is returned.
Default value: -1
detail
The detail property of type :string (Read / Write)
The detail text for the alert dialog.
Default value: nil
message
The message property of type :string (Read / Write)
The message for the alert dialog.
Default value: nil
modal
The modal property of type :boolean (Read / Write)
Whether the alert dialog is modal.
Default value: true

Details

The gtk:alert-dialog object collects the arguments that are needed to present a message to the user. The message is shown with the gtk:alert-dialog-choose function. This API follows the GIO async pattern, and the result can be obtained by calling the gtk:alert-dialog-choose-finish function.

If you do not need to wait for a button to be clicked, you can use the gtk:alert-dialog-show function.

Examples

Create an alert dialog with a g:cancellable object.
(defun create-alert-dialog (parent)
  (let ((dialog (make-instance 'gtk:alert-dialog
                               :message "Alert Alert Alert"
                               :detail "The detail of the alert dialog."
                               :buttons '("Cancel" "OK")
                               :cancel-button 0
                               :default-button 1
                               :modal t))
        (cancellable (g:cancellable-new)))
    ;; Cancel the alert dialog after waiting 10 seconds for user response
    (g:timeout-add-seconds 10
                           (lambda ()
                             (g:cancellable-cancel cancellable)
                             glib:+source-remove+))
    ;; Show the alert dialog
    (gtk:alert-dialog-choose dialog
        parent
        cancellable
        ;; The GAsyncReadyCallback function
        (lambda (source result)
          ;; Get the result
          (let ((result (gtk:alert-dialog-choose-finish source result)))
            (format t "Alert dialog result is ~a~%" result))))))    
Since 4.10
 

Inherited Slot Access Functions

See also

2024-4-11