Gtk2::E...Question(3)

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

πŸ’– Gtk2::E...Question(3) β€” the manual page, bestie edition πŸ’–

okay so. welcome to the User Contributed Perl Documentation for Gtk2::Ex::Dialogs::Question, aka the little module that pops up a yes/no question and lets your user be the main character for three seconds. sit down, grab a strawberry πŸ“, and let's go.


✨ NAME ✨

Gtk2::Ex::Dialogs::Question β€” it literally just provides a simple question dialog. that's the whole vibe. no cap. πŸŽ€


🌸 SYNOPSIS 🌸

here's how you actually use it, copy-paste ready, exact characters and everything:

use Gtk2::Ex::Dialogs::Question ( 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::Question::parent_window = $window;

# now popup a new dialog
my $r = ask Gtk2::Ex::Dialogs::Question ( "Is Perl only hacker's glue?" );
if ( $r ) {
  # end-user thinks so
} else {
  # end-user does not think so
}

look at that. asking the real questions. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

this module hands you a simple dialog api that wraps Gtk2::Dialog objectively. and what's the objective, you ask? a clean and simple question dialog β€” literally just a "NO" button and a "YES" button. that's it. that's the dream. it's giving minimalism. it ate. πŸ‘‘


πŸ’œ OPTIONS πŸ’œ

all public methods (and honestly the entire class, she's generous like that) support these options:

  • title => STRING β€” the title of the dialog window. defaults to an empty string. so if you don't say anything, she's mysterious. πŸ™ˆ
  • text => STRING β€” the text to be displayed. this is the core purpose of the whole module and it's the only mandatory argument. yes, the only one. everything else is optional garnish. ✨
  • icon => /path/to/image || stock-id || Gtk2::Gdk::Pixbuf || Gtk2::Image β€” the dialog-sized image that goes to the left of the text. quick note bestie: there are five aliased stock-ids which correspond to the five gtk-dialog-* ids β€” "warning", "question", "info", "error" and "authentication". defaults to the stock-id "gtk-dialog-question". iconic lineup fr fr. πŸŽ€
  • parent_window => Gtk2::Window β€” reference to the main application window. your app's mother, basically.
  • destroy_with_parent => BOOL β€” when the parent_window is destroyed, what do we do? defaults to FALSE. (the suspense.)
  • modal => BOOL β€” does this message make the parent_window freeze while the message exists? defaults to FALSE. so by default nobody's frozen. no drama. 🧊
  • no_separator => BOOL β€” draw the horizontal separator between the content area and the button area below? defaults to FALSE. so the line is there unless you say otherwise. very demure, very mindful separator. πŸ’…
  • default_yes => BOOL β€” autofocus on the "YES" button. defaults to FALSE. (flip it if you want the optimistic button pre-selected. 🫢)

πŸ‘‘ PUBLIC METHODS πŸ‘‘

OBJECT = new ( OPTIONS | STRING )

creates a new Gtk2::Dialog with stock "NO" and "YES" buttons, some text, and an optional icon to the left of the text. the icon can be any of these:

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

returns a Gtk2::Ex::Dialogs::Question object. 🌈

now for the special case, and this one's cute: if you pass only one argument, all options get set to defaults and that one argument gets used as the text argument. one-arg wonder.

heads up though β€” use of new() is discouraged in favour of ask() or new_and_run(). she said pick the other door. πŸšͺ

RESPONSE = ask ( OPTIONS | STRING ) | new_and_run ( OPTIONS | STRING )

supports all the same arguments as new(). what it does: creates a new Gtk2::Ex::Dialogs::Question, calls show_all(), calls run(), and returns the response of TRUE/'yes' or FALSE/''.

and the tea: ask() is the alias for new_and_run(). same girl, two names. πŸ’–


🌟 SEE ALSO 🌟

go look at these when you're done, they're all in the same friend group:

  • 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

πŸ’€ BUGS πŸ’€

please report any bugs to the mailing list. she's not mad, she just wants to know. 😭


🌸 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>

legends, honestly.


Gtk2::Ex::Dialogs::Question - Provides a simple question 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

and that's the whole page, bestie. this one shipped as perl v5.42.0, dated 2025-07-25, filed under Gtk2::E...Question(3). go forth and ask your questions. πŸ’…βœ¨ periodt.

πŸ“¦ where this page comes from