Gtk2::E...Buttons(3)
π Gtk2::E...Buttons(3) π
okay bestie, sit down, hydrate, because we're talking about Gtk2::Ex::FormFactory::DialogButtons β a page from the User Contributed Perl Documentation, no cap. It's the standard Ok / Apply / Cancel button situation and honestly? iconic. π
β¨ NAME β¨
Gtk2::Ex::FormFactory::DialogButtons β Standard Ok, Apply, Cancel Buttons. that's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
here's how you summon it:
Gtk2::Ex::FormFactory::DialogButtons->new (
clicked_hook_before => CODEREF,
clicked_hook_after => CODEREF,
...
Gtk2::Ex::FormFactory::Container attributes
Gtk2::Ex::FormFactory::Widget attributes
);
like yes, those ... are doing a lot of heavy lifting, and yes, you also get all the Gtk2::Ex::FormFactory::Container attributes and all the Gtk2::Ex::FormFactory::Widget attributes for free. inheritance is such a slay. π¦
β¨ DESCRIPTION β¨
so this class implements a typical Ok, Apply, Cancel buttonbox inside a Gtk2::Ex::FormFactory framework. it's giving very much "the buttons at the bottom of literally every dialog you've ever loved." β¨
if you associate an application object attribute, the value needs to be a hash. that hash may contain the keys 'ok', 'apply' and 'cancel', and those lil keys control the activity of the correspondent buttons. and the question of "should an inactive button be rendered insensitive or just be invisible?" β that's entirely handled by the Gtk2::Ex::FormFactory::Widget attribute inactive. no notes, queen behavior. π
by default, these methods of the associated Gtk2::Ex::FormFactory instance get triggered:
Ok Gtk2::Ex::FormFactory->ok
Cancel Gtk2::Ex::FormFactory->cancel
Apply Gtk2::Ex::FormFactory->apply
so yeah. Ok β ok, Cancel β cancel, Apply β apply. the mapping is doing the absolute least and honestly we respect the efficiency. π
β¨ NOTES β¨
okay this is the important part so listen up bestie, fr fr:
No Cancel and Apply buttons are generated if the associatedGtk2::Ex::FormFactoryhas thesyncattribute set. a synchronized FormFactory applies all changes immediately to the underlying objects, so there is no easy way of implementing the Apply and Cancel buttons. that's just the math. π
but you're resourceful and I believe in you π β you can implement these yourself, e.g. by registering a copy of your object to Gtk2::Ex::FormFactory::Context and hooking into the button clicks using the clicked_hook_before attribute described beyond. yesss, the plot thickens. π§
π OBJECT HIERARCHY π
look at the family tree, she's precious:
Gtk2::Ex::FormFactory::Widget
+--- Gtk2::Ex::FormFactory::DialogButtons
DialogButtons is the child, Widget is the parent, and it's giving main character with a supportive family. π«Ά
β¨ ATTRIBUTES β¨
first up, the house rules π: attributes are handled through the common get_ATTR(), set_ATTR() style accessors, but they are mostly passed once to the object constructor and must not be altered after the associated FormFactory was built. don't be messy, okay?
clicked_hook_before = CODEREF("ok"|"apply"|"cancel")β use this callback to hook into the clicked signal handler of the buttons. the argument it gets is the name of the button actually clicked, so it's"ok","apply"or"cancel". and here's the tea β: if the callback returnsTRUE,Gtk2::Ex::FormFactory's default handler for the button gets called afterwards. returnFALSEto prevent the default handler from ever running. you have the power, use it wisely. πclicked_hook_after = CODEREF("ok"|"apply"|"cancel")β this callback is called after the default handler. super useful if you wanna exit your program cleanly when your main dialog was closed. the sequence is: firstGtk2::Ex::FormFactorycloses the dialog window for you and does all the necessary cleanup stuff, then afterward you simply callGtk2->main_quitto exit the program. clean exit, no crumbs. β¨
and the callback's return value doesn't matter. literally doesn't care. zero opinions. π
for more attributes, refer to Gtk2::Ex::FormFactory::Widget. go read that one next, bestie. π
π AUTHORS π
JΓΆrn Reder <joern at zyn dot de>
one legend, one author, one email address with the classic "at / dot" obfuscation. respect the craft. π
π COPYRIGHT AND LICENSE π
Copyright 2004-2006 by JΓΆrn Reder.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details.
You should have received a copy of the GNU Library 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.
π« POD ERRORS π«
bestie. bestie. the document had some coding errors. it's fine. we're fine. here's what happened:
Hey! The above document had some coding errors, which are explained below:
Around line 213:
Non-ASCII character seen before =encoding in 'JΓΆrn'. Assuming UTF-8
the ΓΆ in JΓΆrn just showed up unannounced without a =encoding declaration and Perl was like "π assuming UTF-8 I guess." honestly? valid assumption. iconic ΓΆ. π
and that's the whole page, you're officially a DialogButtons expert, no cap π
this was pulled from perl v5.42.0, dated 2025-07-25. go forth and build beautiful buttonboxes, bestie. slay. π β¨πΈ
π¦ where this page comes from
- fedora 43: perl-Gtk2-Ex-FormFactory 0.67-39.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms