Gtk2::E...Message(3)

πŸ“¦
version 0.11 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::Ex::Dialogs::Message(3) πŸ’–

okay bestie, so this page is all about Gtk2::Ex::Dialogs::Message β€” a lil Perl module from the User Contributed Perl Documentation ✨ she's giving "popup that just says stuff and has one (1) OK button" and honestly? iconic.


🌸 NAME 🌸

Gtk2::Ex::Dialogs::Message β€” Provides a simple message dialog.

like. it's a dialog. it shows a message. that's the whole job. and she does it flawlessly πŸ’…


✨ SYNOPSIS ✨

 use Gtk2::Ex::Dialogs::Message ( destroy_with_parent => TRUE,
                                  modal => TRUE,
                                  no_separator => FALSE );

 # do some stuff like creating your app's main $window then,
 # to ensure that all messages use the right parent, set it:
 $Gtk2::Ex::Dialogs::Message::parent_window = $window;

 # now popup a new dialog ( blocking the main loop if there is one )
 new_and_run
  Gtk2::Ex::Dialogs::Message ( title => "Dialog Title",
                               text => "This is a simple message" );

 # now popup a somwhat useful dialog that doesn't block any main loop
 # but on the other side of the coin, if there is no main loop the
 # dialog will be completely unresponsive.
 new_show
  Gtk2::Ex::Dialogs::Message ( title => "Uhm",
                               text => "Use when there is a main loop." );

(and yes, the comments and the typos in there are hers, we're keeping them exactly as they are β€” somwhat is a vibe, not a mistake, don't @ me 😭)


πŸ¦‹ DESCRIPTION πŸ¦‹

So this module hands you a simple dialog api that wraps Gtk2::Dialog objectively. The whole goal, the entire dream, the main character energy here? A clean and simple message dialog with literally just an "OK" button. No options paralysis. No nonsense. Just vibes and an OK button. 🫢


πŸŽ€ OPTIONS πŸŽ€

Every public method (and honestly the entire class, she's generous like that) supports all of these:

  • title => STRING β€” the title of the dialog window. Defaults to an empty string. (no title? fine. mysterious. we love a cryptic queen πŸ™ˆ)
  • text => STRING β€” the text to be displayed. This is literally the whole point of the module, and it's the only mandatory argument. you cannot skip this one bestie, it's the moment πŸ’–
  • icon => /path/to/image || stock-id || Gtk2::Gdk::Pixbuf || Gtk2::Image β€” the dialog-sized image you place to the left of the text. Heads up: there are five aliased stock-ids that line up with the five gtk-dialog-* ids β€” they are "warning", "question", "info", "error" and "authentication". Defaults to no icon being created at all β€” minimalism, she invented it πŸ’…
  • parent_window => Gtk2::Window β€” a reference to the main application window. the parental figure. the one who keeps everything anchored πŸ₯Ί
  • destroy_with_parent => BOOL β€” when the parent_window gets destroyed, what do we do?? Defaults to FALSE. (she will simply persist. ghosting the parent, lowkey πŸ’€)
  • modal => BOOL β€” does this message make the parent_window freeze while the message exists? Defaults to FALSE. set it TRUE and the parent is on pause till you dismiss her. main character behavior fr fr πŸ‘‘
  • no_separator => BOOL β€” draw the horizontal separator between the content area and the button area below? Defaults to FALSE. (that's the lil line, the aesthetic divider, the ~moment~ 🌈)

🌟 PUBLIC METHODS 🌟

OBJECT = new ( OPTIONS | STRING )

Create a fresh Gtk2::Dialog with only an "OK" button, some text, and an optional icon to the left of the text. The icon can be any of these cuties:

  • a stock-id string
  • a Gtk2::Image
  • Gtk2::Gdk::Pixbuf
  • or the full path to an image

Returns a Gtk2::Ex::Dialogs::Message object ✨

And here's the special case, the lil easter egg: if you pass only one argument, then all the options get set to their defaults and that one lone argument is used as the text option. one-arg wonder. we stan a shortcut πŸŽ€

new_and_run ( OPTIONS )

Supports all the same arguments as new(). This will create a new Gtk2::Ex::Dialogs::Message, then show_all(), then run(), and then destroy the dialog immediately. in and out. no lingering. periodt πŸ’…

new_and_show ( OPTIONS )

Supports all the same arguments as new(). This creates a new Gtk2::Ex::Dialogs::Message, calls show_all(), and processes any pending gtk events.

⚠️ okay real talk bestie: this functionality is only of any practical use when there is a Gtk2 main loop running. If there's no main loop running, the dialog will be visible but completely unresponsive to the end-user. like she's there. she's on screen. she simply will not answer you. πŸ’€ please read the room before using this one.

πŸ”₯ SEE ALSO πŸ”₯

  • Gtk2::Dialog
  • Gtk2::MessageDialog
  • Gtk2::Ex::Dialogs
  • Gtk2::Ex::Dialogs::ChooseDirectory
  • Gtk2::Ex::Dialogs::ChooseFile
  • Gtk2::Ex::Dialogs::ChoosePreviewFile
  • Gtk2::Ex::Dialogs::ErrorMsg
  • Gtk2::Ex::Dialogs::Message

(the whole friend group 🫢 go say hi to all of them)


πŸ’€ BUGS πŸ’€

Please report any bugs to the mailing list. (mailing list deets right below, don't scroll past her πŸ™ˆ)


πŸ’Œ MAILING LIST πŸ’Œ

 http://opendoorsoftware.com/lists/gtk2-ex-list
 gtk2-ex-list@opendoorsoftware.com

πŸ‘‘ AUTHORS πŸ‘‘

 Kevin C. Krinke, <kckrinke@opendoorsoftware.com>
 James Greenhalgh, <jgreenhalgh@opendoorsoftware.com>

the legends. the icons. the ones who wrote this whole thing πŸ’œ


 Gtk2::Ex::Dialogs::Message - Provides a simple message dialog.
 Copyright (C) 2005 Open Door Software Inc. <ods@opendoorsoftware.com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
πŸ“ fyi: that's the GNU Lesser General Public License, version 2.1 or any later version, and yes β€” WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE is doing a lot of heavy lifting there, so read it, bestie, it matters πŸ’–

and that's the whole page!! mwah πŸ’‹ this shipped with perl v5.42.0 and the docs are dated 2025-07-25 β€” so go forth, pop up ur lil message dialogs, and remember: only an "OK" button, and that's all she ever needed πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from