Package: gtk

Class gtk:message-dialog

Superclasses

Documented Subclasses

None

Direct Slots

buttons
The buttons property of type gtk:buttons-type (Construct Only)
The buttons shown in the message dialog.
Note: The property can be set only in a constructor and is not readable or writable. There is no accessor.
Default value: :none
message-area
The message-area property of type gtk:widget (Read)
The gtk:box widget with :vertical orientation that corresponds to the message area of the message dialog. See the gtk:message-dialog-message-area function for a detailed description of the message area.
message-type
The message-type property of type gtk:message-type (Read / Write / Construct)
The type of the message dialog.
Default value: :info
secondary-text
The secondary-text property of type :string (Read / Write)
The secondary text for the message dialog.
Default value: nil
secondary-use-markup
The secondary-use-markup property of type :boolean (Read / Write)
True if the secondary text of the message dialog includes Pango markup.
Default value: false
text
The text property of type :string (Read / Write)
The primary text for the message dialog. If the message dialog has a secondary text, this will appear as the title.
Default value: ""
use-markup
The use-markup property of type :boolean (Read / Write)
True if the primary text for the message dialog includes Pango markup.
Default value: false

Details

The gtk:message-dialog widget presents a dialog with some message text. It is simply a convenience widget. You could construct the equivalent of a message dialog from a gtk:dialog widget without too much effort, but the gtk:message-dialog widget saves typing.

Figure: GtkMessageDialog

The easiest way to do a modal message dialog is to use the :modal flag of the gtk:dialog-flags flags. The message dialog will prevent interaction with the parent window until it is hidden or destroyed. You can use the "response" signal to know when the user dismissed the message dialog.

Examples

An example for creating a modal message dialog.
(defun create-message-dialog-simple (parent)
  (let ((dialog (make-instance 'gtk:message-dialog
                               :transient-for parent
                               :modal t
                               :message-type :info
                               :buttons :ok
                               :text "Message Dialog"
                               :secondary-text "The secondary text.")))
    ;; Handler for the "response" signal of the dialog
    (g:signal-connect dialog "response"
                      (lambda (dialog response)
                        (gtk:window-destroy dialog)))
    (gtk:window-present dialog)))    
This is a variant that uses the gtk:message-dialog-new function. The first example is more lispy and the implementation more favorable.
(defun create-message-dialog-simple2 (parent)
  (let ((dialog (gtk:message-dialog-new parent
                                        '(:modal)
                                        :info
                                        :ok-cancel
                                        "Message Dialog"
                                        parent)))
    ;; Set secondary text with the accessor
    (setf (gtk:message-dialog-secondary-text dialog)
          "Created with constructor and with two buttons.")
    ;; Handler for the "response" signal of the dialog
    (g:signal-connect dialog "response"
                      (lambda (dialog response)
                        (gtk:window-destroy dialog)))
    (gtk:window-present dialog)))    

GtkMessageDialog as GtkBuildable

The gtk:message-dialog implementation of the gtk:buildable interface exposes the message area as an internal child with the name message_area.

Warning

The gtk:message-dialog widget is deprecated since 4.10. Use the gtk:alert-dialog widget instead.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2025-2-26