About all my projects
Gnome::Gtk4::MessageDialog

Gnome::Gtk4::MessageDialog

Description

Gnome::Gtk4::MessageDialog presents a dialog with some message text.

No caption

It’s simply a convenience widget; you could construct the equivalent of Gnome::Gtk4::MessageDialog from Gnome::Gtk4::Dialog without too much effort, but Gnome::Gtk4::MessageDialog saves typing.

The easiest way to do a modal message dialog is to use the GTK_DIALOG_MODAL flag, which will call .set-modal() in class Gnome::Gtk4::Window internally. The dialog will prevent interaction with the parent window until it's hidden or destroyed. You can use the response defined in Dialog signal to know when the user dismissed the dialog.

An example for using a modal dialog:

You might do a non-modal Gnome::Gtk4::MessageDialog simply by omitting the GTK_DIALOG_MODAL flag:

GtkMessageDialog as GtkBuildable

The Gnome::Gtk4::MessageDialog implementation of the Gnome::Gtk4::R-Buildable interface exposes the message area as an internal child with the name “message_area”.

Class initialization

Note: The native version of this class is deprecated in gtk4-lib() since version 4.10

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-messagedialog This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new message dialog.

This is a simple dialog with some text the user may want to see. When the user clicks a button a “response” signal is emitted with response IDs from enumeration ResponseType from Gnome::Gtk4::T-dialog . See Gnome::Gtk4::Dialog for more details.

method new-messagedialog ( N-Object() $parent, UInt $flags, GtkMessageType $type, GtkButtonsType $buttons, Str $message-format, … --> Gnome::Gtk4::MessageDialog \)
  • $parent; transient parent.

  • $flags; flags.

  • $type; type of message.

  • $buttons; set of buttons to use.

  • $message-format; printf()-style format string.

  • …; …. Note that each argument must be specified as a type followed by its value!

new-with-markup This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new message dialog.

This is a simple dialog with some text that is marked up with Pango markup. When the user clicks a button a “response” signal is emitted with response IDs from enumeration ResponseType from Gnome::Gtk4::T-dialog . See Gnome::Gtk4::Dialog for more details.

Special XML characters in the printf() arguments passed to this function will automatically be escaped as necessary. (See g_markup_printf_escaped() for how this is implemented.) Usually this is what you want, but if you have an existing Pango markup string that you want to use literally as the label, then you need to use .set-markup() instead, since you can’t pass the markup string either as the format (it might contain “%” characters) or as a string argument.

method new-with-markup ( N-Object() $parent, UInt $flags, GtkMessageType $type, GtkButtonsType $buttons, Str $message-format, … --> Gnome::Gtk4::MessageDialog \)
  • $parent; transient parent.

  • $flags; flags.

  • $type; type of message.

  • $buttons; set of buttons to use.

  • $message-format; printf()-style format string.

  • …; …. Note that each argument must be specified as a type followed by its value!

Methods

format-secondary-markup This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the secondary text of the message dialog.

The $message-format is assumed to contain Pango markup.

Due to an oversight, this function does not escape special XML characters like .new-with-markup() does. Thus, if the arguments may contain special XML characters, you should use g_markup_printf_escaped() to escape it.

method format-secondary-markup ( Str $message-format, … )
  • $message-format; printf()-style string with Pango markup.

  • …; …. Note that each argument must be specified as a type followed by its value!

format-secondary-text This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the secondary text of the message dialog.

method format-secondary-text ( Str $message-format, … )
  • $message-format; printf()-style format string.

  • …; …. Note that each argument must be specified as a type followed by its value!

get-message-area

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the message area of the dialog.

This is the box where the dialog’s primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels. See .get-content-area() in class Gnome::Gtk4::Dialog for the corresponding function in the parent Gnome::Gtk4::Dialog.

method get-message-area (--> N-Object )

Return value; A Gnome::Gtk4::Box corresponding to the “message area” in the $message-dialog.

set-markup

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the text of the message dialog.

method set-markup ( Str $str )
  • $str; string with Pango markup.