UI::Di...Dialog(3pm)

πŸ“¦
version 1.21 Β· 3 versions
, in ubuntu jammy, ubuntu noble

πŸ’– UI::Dialog::Backend::XDialog πŸ’–

okay bestie, listen up β€” this is the perl doc for UI::Dialog::Backend::XDialog, part of the User Contributed Perl Documentation. it's the glow-up wrapper that makes the Xdialog(1) app speak fluent Perl, and honestly? iconic. πŸŽ€


✨ NAME ✨

UI::Dialog::Backend::XDialog β€” it's the backend for the Xdialog(1) app. that's it, that's the name, periodt. πŸ’…


🌈 SYNOPSIS 🌈

here's the vibe, copy-paste girlies:

use UI::Dialog::Backend::XDialog;
my $d = new UI::Dialog::Backend::XDialog ( backtitle => 'Demo',
                                           title => 'Default',
                                           height => 20, width=>65,
                                           listheight => 5 );

$d->msgbox( title => 'Welcome!', text => 'Welcome one and all!' );

look at that. so clean. so demure. ✨


πŸ¦‹ ABSTRACT πŸ¦‹

so UI::Dialog::Backend::XDialog is literally the UI::Dialog backend for the Xdialog(1) application. when you roll with this module through UI::Dialog or any other meta module, only the compatible methods are ever reachable β€” like, the doors that open are the ones everyone agrees on. πŸšͺ

BUT. and this is the fun part. when you use this module directly in your own app (like in that SYNOPSIS up there), you unlock access to ALL the options and features of the real Xdialog(1) application. main character energy fr fr. πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

this backend is a wrapper for the Xdialog(1) application, and it genuinely tries to extend every single facet of Xdialog(1) to you, the Perl programmer. if you wanna know about the various widgets, the best reference is the fine Xdialog(1) manual β€” it's got the definitive deets on the Xdialog application itself. this perldoc is just the lil sparknotes: it briefly describes all the supported options and widgets. 🫢

note note note πŸ“ β€” XDialog supports newlines (\n) inside its message text area, but UI::Dialog strips the newlines so it doesn't break all the other backends. so if you're using XDialog specifically and you want those newlines to stay? set the literal option to 1 and the message text will be left exactly as it was literally given. slay. πŸ’…

🌸 EXPORT 🌸

None

that's right, nothing. no exports. she gives nothing and that's the point. πŸ’€


πŸŽ€ INHERITS πŸŽ€

UI::Dialog::Backend

family tree moment. 🧬


πŸ‘‘ CONSTRUCTOR πŸ‘‘

new( @options )

EXAMPLE

my $d = new( title => 'Default Title', backtitle => 'Backtitle',
             width => 65, height => 20, listheight => 5 );

DESCRIPTION

this is the Class Constructor method, bestie. it takes a list of key => value pairs and uses them as the defaults whenever you interact with the various widgets. set it once, vibe forever. ✨

RETURNS

a blessed object reference of the UI::Dialog::Backend::XDialog class. 🫢

OPTIONS

okay so the (...) after each option shows the default for that option. and an * means it's supported by all the widget methods on a per-use policy, defaulting to whatever values you decided during object creation. iykyk. πŸ’«

  • debug = 0,1,2 (0)
  • literal = 0,1 (0)
  • PATH = [ /bin, /usr/bin, /usr/local/bin, /opt/bin ] (as indicated)
  • wmclass = "name" ('') *
  • rc-file = "/path/to/any/gtkrc" ('') *
  • backtitle = "backtitle" ('') *
  • title = "title" ('') *
  • allowclose = 0,1 (0) *
  • noclose = 0,1 (0) *
  • screencenter = 0,1 (0) *
  • undermouse = 0,1 (0) *
  • autoplacement = 0,1 (0) *
  • center = 0,1 (0) *
  • right = 0,1 (0) *
  • left = 0,1 (0) *
  • fill = 0,1 (0) *
  • nowrap = 0,1 (0) *
  • wrap = 0,1 (0) *
  • crwrap = 0,1 (0) *
  • nocrwrap = 0,1 (0) *
  • buttonsstyle = default,icon,text (default) *
  • fixedfont = 0,1 (0) *
  • editable = 0,1 (0) *
  • timestamp = 0,1 (0) *
  • datestamp = 0,1 (0) *
  • reverse = 0,1 (0) *
  • keepcolors = 0,1 (0) *
  • interval = \d+ (0) *
  • notags = 0,1 (0) *
  • itemhelp = 0,1 (0) *
  • defaultitem = "tag" ('') *
  • icon = "/path/to/file.xpm" ('') *
  • nook = 0,1 (0) *
  • nocancel = 0,1 (0) *
  • nobuttons = 0,1 (0) *
  • defaultno = 0,1 (0) *
  • wizard = 0,1 (0) *
  • help = "help" ('') *
  • print = "lp0" ('') *
  • check = "label" ('') *
  • oklabel = "label" ('') *
  • cancellabel = "label" ('') *
  • beepbin = "/usr/bin/beep" ('/usr/bin/beep') *
  • beepbefore = 0,1 (0) *
  • beepafter = 0,1 (0) *
  • begin = [ $y, $x ] (0) *
  • ignoreeof = 0,1 (0) *
  • smooth = 0,1 (0) *
  • height = \d+ (20) *
  • width = \d+ (65) *
  • listheight = \d+ (5) *
  • percentage = \d+ (0)

🧚 WIDGET METHODS 🧚

yesno( )

EXAMPLE

if ($d->yesno( text => 'A binary type question?') ) {
    # user pressed yes
} else {
    # user pressed no or cancel
}

DESCRIPTION

you present the end user with a message box that has two buttons: yes and no. a lil binary moment. πŸ€”

RETURNS

TRUE (1) for a response of YES, or FALSE (0) for literally anything else.


msgbox( )

EXAMPLE

$d->msgbox( text => 'A simple message' );

DESCRIPTION

you present the end user with a message box that has an OK button. simple, iconic, no notes. ✨

RETURNS

TRUE (1) for a response of OK, or FALSE (0) for anything else.


infobox( )

EXAMPLE

$d->infobox( text => 'Information to convey.', timeout => 5000 );

DESCRIPTION

you present the end user with a message box that disappears after a certain length of time. the 'timeout' argument is in milliseconds. the default timeout is 5000 milliseconds (that's 5 seconds, bestie). yes, this message will self destruct πŸ’€πŸ”₯. you can also use the alternate timeout option 'wait', which gets interpreted in seconds instead of milliseconds. two timezones, one vibe. ⏰

RETURNS

TRUE (1) for a response of OK or a normal timeout, or FALSE (0) for anything else.


gauge_start( ) progress_start( )

EXAMPLE

$d->gauge_start( text => 'gauge...', percentage => 1 );
$d->progress_start( text => 'progres...', percentage => 1 );

DESCRIPTION

display a meter bar to the user. this gets the widget realized, but it needs the other gauge_*() methods to actually do anything. there are two such meter bars provided by Xdialog(1), and both are handled independently of each other. which means... an interesting situation is possible: two progress meters up at the same time, both fully functional. duality. πŸŒ—

#
# Progressive Duality :)
#
$d->gauge_start( text => 'gauge...', begin => [ 10, 10 ] );
$d->progress_start( text => 'progres...' );
foreach my $i (10,20,30,40,50,60,70,80,90,100) {
    $d->gauge_set($i);
    sleep(1);
    $d->progress_set($i);
    sleep(1);
}
$d->gauge_stop();
$d->progress_stop();

RETURNS

TRUE (1) if the widget loaded fine, or FALSE (0) for anything else.


gauge_inc( ) progress_inc( )

EXAMPLE

$d->gauge_inc( 1 );
$d->progress_inc( 1 );

DESCRIPTION

increment the meter by the given amount. go up, up, up πŸ“ˆ

RETURNS

TRUE (1) if the widget incremented fine, or FALSE (0) for anything else.


gauge_dec( ) progress_dec( )

EXAMPLE

$d->gauge_dec( 1 );
$d->progress_dec( 1 );

DESCRIPTION

decrement the meter by the given amount. down, down, down πŸ“‰

RETURNS

TRUE (1) if the widget decremented fine, or FALSE (0) for anything else.


gauge_set( ) progress_set( )

EXAMPLE

$d->gauge_set( 99 );
$d->progress_inc( 99 );

DESCRIPTION

set the meter bar to the given amount. pinpoint precision, no cap. 🎯

RETURNS

TRUE (1) if the widget set fine, or FALSE (0) for anything else.


gauge_text( )

EXAMPLE

$d->gauge_text( 'string' );

DESCRIPTION

set the meter bar message to the given string. caption glow-up. πŸ’¬

RETURNS

TRUE (1) if the widget set fine, or FALSE (0) for anything else.


gauge_stop( ) progress_stop( )

EXAMPLE

$d->gauge_stop();
$d->progress_stop();

DESCRIPTION

end the meter bar widget process. say bye bye πŸ‘‹

RETURNS

TRUE (1) if the widget closed fine, or FALSE (0) for anything else.


password( )

EXAMPLE

my $string = $d->password( text => 'Enter some (hidden) text.' );

DESCRIPTION

you present the end user with a text input field that does not reveal the input (except to the script, obviously) plus a message. sneaky, but make it fashion. πŸ™ˆ

RETURNS

a SCALAR if the response is OK, or FALSE (0) for anything else.


passwords2( )

EXAMPLE

my @strings = $d->passwords2( text => 'Enter some (hidden) text.',
                               label1 => 'first field label',
                               label2 => 'second field label' );

DESCRIPTION

you present the end user with two (labeled) password input fields. double the secrecy. πŸ•΅οΈ

RETURNS

an ARRAY of up to two elements if the response is OK, or FALSE (0) for anything else.


passwords3( )

EXAMPLE

my @strings = $d->passwords3( text => 'Enter some (hidden) text.',
                               label1 => 'first field label',
                               label2 => 'second field label',
                               label3 => 'third field label' );

DESCRIPTION

you present the end user with three (labeled) password input fields. triple threat. πŸ’…

RETURNS

an ARRAY of up to three elements if the response is OK, or FALSE (0) for anything else.


inputbox( )

EXAMPLE

my $string = $d->inputbox( text => 'Enter some text...',
                           entry => 'this is the input field' );

DESCRIPTION

you present the end user with a text input field and a message. the classic. the blueprint. ✨

RETURNS

a SCALAR if the response is OK, or FALSE (0) for anything else.


inputsbox2( )

EXAMPLE

my @strings = $d->inputsbox2( text => 'Enter some text.',
                              label1 => 'first field label',
                              input1 => '1st input field',
                              label2 => 'second field label',
                              input2 => '2nd input field' );

DESCRIPTION

you present the end user with two (labeled) text input fields. dynamic duo. 🫢

RETURNS

an ARRAY of up to two elements if the response is OK, or FALSE (0) for anything else.


inputsbox3( )

EXAMPLE

my @strings = $d->inputsbox3( text => 'Enter some text.',
                              label1 => 'first field label',
                              input1 => '1st input field',
                              label2 => 'second field label',
                              input2 => '2nd input field',
                              label3 => 'third field label',
                              input3 => '3rd input field' );

DESCRIPTION

you present the end user with three (labeled) text input fields. the whole squad is here. 🌈

RETURNS

an ARRAY of up to three elements if the response is OK, or FALSE (0) for anything else.

πŸ’« combobox( ) πŸ’«

EXAMPLE

my $string = $d->combobox( text => 'Enter some text.',
                            editable => 1, list => [ 'item1',
                                                     'item2' ] );

DESCRIPTION

Okay so this one pops a dropdown list at your user, and bestie, it can be editable if you want it to be. Choices on choices. Iconic. πŸŽ€

RETURNS

a SCALAR if the response is OK, or TRUE (1) if it's OK, and FALSE (0) for literally anything else. πŸ’€


πŸ’« rangebox( ) πŸ’«

EXAMPLE

my $string = $d->rangebox( text => 'Pick a number...',
                           min => 0, max => 100, def => 50 );

DESCRIPTION

Slides a range slider + a lil message into your user's view. Very demure, very slider. ✨

RETURNS

a SCALAR if the response is OK, and FALSE (0) for anything else. 😭


πŸ’« rangesbox2( ) πŸ’«

EXAMPLE

my @strings = $d->rangesbox2( text => 'Pick a number...',
                              label1 => 'first slider label',
                              min1 => 0, max1 => 100, def1 => 50,
                              label2 => 'second slider label',
                              min1 => 0, max2 => 10, def2 => 5 );

DESCRIPTION

Not one but two (labeled!) text range fields. Double the sliders, double the slay. πŸ’…

RETURNS

an ARRAY of up to two elements if the response is OK, and FALSE (0) for anything else. 🫢


πŸ’« rangesbox3( ) πŸ’«

EXAMPLE

my @strings = $d->rangesbox3( text => 'Pick a number...',
                              label1 => 'first slider label',
                              min1 => 10, max1 => 100, def1 => 50,
                              label2 => 'second slider label',
                              min2 => 1, max2 => 10, def2 => 5,
                              label3 => 'third slider label',
                              min3 => 2, max3 => 7, def3 => 5 );

DESCRIPTION

Three (labeled) range sliders, bestie. It's giving slider superset. πŸ‘‘

RETURNS

an ARRAY of up to three elements if the response is OK, and FALSE (0) for anything else. πŸ¦‹


πŸ’« spinbox( ) πŸ’«

EXAMPLE

my $string = $d->spinbox( text => 'Pick a number...',
                          min => 0, max => 100, def => 50 );

DESCRIPTION

A spin slider + a message. Spinny. Adorable. No cap. πŸŒ€

RETURNS

a SCALAR if the response is OK, and FALSE (0) for anything else. 🌸


πŸ’« spinsbox2( ) πŸ’«

EXAMPLE

my @strings = $d->spinsbox2( text => 'Pick a number...',
                             label1 => 'first slider label',
                             min1 => 0, max1 => 100, def1 => 50,
                             label2 => 'second slider label',
                             min1 => 0, max2 => 10, def2 => 5 );

DESCRIPTION

Two (labeled) text spin fields. Spin twins fr fr. πŸŽ€

RETURNS

an ARRAY of up to two elements if the response is OK, and FALSE (0) for anything else. 😭


πŸ’« spinsbox3( ) πŸ’«

EXAMPLE

my @strings = $d->spinsbox3( text => 'Pick a number...',
                             label1 => 'first slider label',
                             min1 => 10, max1 => 100, def1 => 50,
                             label2 => 'second slider label',
                             min2 => 1, max2 => 10, def2 => 5,
                             label3 => 'third slider label',
                             min3 => 25, max3 => 75, def3 => 50 );

DESCRIPTION

Three (labeled) spin sliders. The trio we deserve. ✨

RETURNS

an ARRAY of up to three elements if the response is OK, and FALSE (0) for anything else. πŸ’–


πŸ’« textbox( ) πŸ’«

EXAMPLE

$d->textbox( path => '/path/to/a/text/file' );

DESCRIPTION

Shows your user a simple scrolling box stuffed with the contents of whatever text file you point it at. Cozy lil read-only moment. πŸ“–

RETURNS

TRUE (1) if the response is OK, and FALSE (0) for anything else. 🌈


πŸ’« editbox( ) πŸ’«

EXAMPLE

my $text = $d->editbox( path => '/path/to/a/text/file' );

DESCRIPTION

Same scrolling box energy, but now it's editable β€” it's giving main character energy for the contents of that text file. πŸ’…

RETURNS

a multiline SCALAR if the response is OK, and FALSE (0) for anything else. 🫢


πŸ’« tailbox( ) πŸ’«

EXAMPLE

$d->tailbox( path => '/path/to/a/text/file' );

DESCRIPTION

A scrolling box holding the contents of the given text file β€” except the window keeps updating itself, basically doing the exact same thing the unix tail(1) command does. Constantly refreshing. Never not watching. πŸ‘€

RETURNS

TRUE (1) if the response is OK, and FALSE (0) for anything else. πŸ”₯


πŸ’« logbox( ) πŸ’«

EXAMPLE

$d->logbox( path => '/path/to/a/text/file',
            timestamp => 1, datestamp => 1, reverse => 0 );

DESCRIPTION

A scrolling box with the contents of your text file, and like tailbox it keeps the window constantly updated in a similar manner to the unix tail(1) command. But plot twist bestie: this widget can also colourize the output based on any ASCII colour escape sequences it finds inside the file. Colour-coded chaos. πŸŒˆπŸ’€

RETURNS

TRUE (1) if the response is OK, and FALSE (0) for anything else. ⭐


EXAMPLE

my $selection1 = $d->menu( text => 'Select one:',
                           list => [ 'tag1', 'item1',
                                     'tag2', 'item2',
                                     'tag3', 'item3' ] );

my $selection2 = $d->menu( text => 'Select one:',
                           itemhelp => 1,
                           list => [ 'tag1', 'item1', 'help1',
                                     'tag2', 'item2', 'help2',
                                     'tag3', 'item3', 'help3' ]
                         );

DESCRIPTION

Hands your user a selectable list, with optional help tips if you're feeling generous. πŸŽ€

RETURNS

a SCALAR of the chosen tag if the response is OK, and FALSE (0) for anything else. πŸ‘‘


πŸ’« checklist( ) πŸ’«

EXAMPLE

my @selection1 = $d->checklist( text => 'Select one:',
                                list => [ 'tag1', [ 'item1', 0 ],
                                          'tag2', [ 'item2', 1 ],
                                          'tag3', [ 'item3', 1 ] ]
                              );

my @selection2 = $d->checklist( text => 'Select one:',
                                itemhelp => 1,
                                list => [ 'tag1',
                                          [ 'item1', 0, 'help1' ],
                                          'tag2',
                                          [ 'item2', 1, 'help2' ],
                                          'tag3',
                                          [ 'item3', 1, 'help3' ]
                                        ]
                              );

DESCRIPTION

A selectable checklist for your user, plus optional help tips. Check all the boxes, bestie. βœ…

RETURNS

an ARRAY of the chosen tags if the response is OK, and FALSE (0) for anything else. πŸ¦‹


πŸ’« radiolist( ) πŸ’«

EXAMPLE

my $selection1 = $d->radiolist( text => 'Select one:',
                                list => [ 'tag1', [ 'item1', 0 ],
                                          'tag2', [ 'item2', 1 ],
                                          'tag3', [ 'item3', 0 ] ]
                              );

my $selection2 = $d->radiolist( text => 'Select one:',
                                itemhelp => 1,
                                list => [ 'tag1',
                                          [ 'item1', 0, 'help1' ],
                                          'tag2',
                                          [ 'item2', 1, 'help2' ],
                                          'tag3',
                                          [ 'item3', 0, 'help3' ]
                                        ]
                              );

DESCRIPTION

A selectable radiolist for your user, with optional help tips. Pick exactly one, no take-backs. πŸ”˜

RETURNS

a SCALAR of the chosen tag if the response is OK, and FALSE (0) for anything else. πŸ’œ


πŸ’« buildlist( ) πŸ’«

EXAMPLE

my $selection1 = $d->buildlist( text => 'Select one:',
                                list => [ 'tag1', [ 'item1', 0 ],
                                          'tag2', [ 'item2', 1 ],
                                          'tag3', [ 'item3', 0 ] ]
                              );

my $selection2 = $d->buildlist( text => 'Select one:',
                                itemhelp => 1,
                                list => [ 'tag1',
                                          [ 'item1', 0, 'help1' ],
                                          'tag2',
                                          [ 'item2', 1, 'help2' ],
                                          'tag3',
                                          [ 'item3', 0, 'help3' ]
                                        ]
                               );

DESCRIPTION

A buildable list for your user, plus optional help tips. Assemble your selection like the icon you are. 🧚

RETURNS

a SCALAR of the chosen tag if the response is OK, and FALSE (0) for anything else. 🌸


πŸ’« treeview( ) πŸ’«

EXAMPLE

my $selection1 = $d->treeview( text => 'Select one:',
                               list => [ 'tag1',
                                         [ 'item1', 0, 1 ],
                                         'tag2',
                                         [ 'item2', 1, 2 ],
                                         'tag3',
                                         [ 'item3', 0, 2 ]
                                       ]
                             );

my $selection2 = $d->treeview( text => 'Select one:',
                               itemhelp => 1,
                               list => [ 'tag1',
                                         [ 'item1',0,1,'help1' ],
                                         'tag2',
                                         [ 'item2',1,2,'help2' ],
                                         'tag3',
                                         [ 'item3',0,2,'help3' ]
                                       ]
                             );

DESCRIPTION

(continues in the next part β€” hold on bestie)

✨ DESCRIPTION ✨

okay so bestie, this one's a whole treeview moment 🌳✨ You present the user with a treeview of items, plus optional help tips if you're feeling generous. The treeview list is made up of an array(ref) consisting of a name (which is returned upon user selection) and an array reference containing the details of the item. And what's in that details array, you ask? A description string, a status indicator (1,0), the desired tree depth, and the optional help string. That's the whole vibe, no cap.

 [ 'ReturnName',
   [ 'Description of item',
     $status,
     $depth,
     'help string is ignored unless itemhelp is non-null.'
   ]
 }
heads up fr fr: that help string is literally ignored unless itemhelp is non-null. Not a suggestion, that's just the rules πŸ’…

✨ RETURNS ✨

You get back a SCALAR of the chosen tag if the response is OK πŸŽ‰ and FALSE (0) for anything else. That's it, that's the return. Periodt. πŸ’–


πŸ¦‹ fselect( ) πŸ¦‹

EXAMPLE

my $text = $d->fselect( path => '/path/to/a/file/or/directory' );

DESCRIPTION

Present the user with a file selection widget preset with the given path. Iconic, honestly. πŸ—‚οΈβœ¨

RETURNS

a SCALAR if the response is OK and FALSE (0) for anything else.


πŸ¦‹ dselect( ) πŸ¦‹

EXAMPLE

my $text = $d->dselect( path => '/path/to/a/file/or/directory' );

DESCRIPTION

Present the user with a file selection widget preset with the given path. But here's the tea: unlike fselect() this widget will only return a directory selection. πŸ“ No files allowed, bestie, only folders.

RETURNS

a SCALAR if the response is OK and FALSE (0) for anything else.


πŸ¦‹ calendar( ) πŸ¦‹

EXAMPLE

my $date = $d->calendar( text => 'Pick a date...',
                         day => 1, month => 1, year => 1970 );
my ($m,$d,$y) = split(/\//,$date);

DESCRIPTION

Present the user with a calendar widget preset with the given date. Main character scheduling energy πŸ—“οΈπŸ‘‘

RETURNS

a SCALAR if the response is OK and FALSE (0) for anything else.


πŸ¦‹ timebox( ) πŸ¦‹

EXAMPLE

my $time = $d->timebox( text => 'What time?' );
my ($h,$m,$s) = split(/\:/,$time);

DESCRIPTION

Present the user with a time widget preset with the current time. Clock app but make it perl β°πŸ’œ

RETURNS

a SCALAR if the response is OK and FALSE (0) for anything else.


πŸ” SEE ALSO πŸ”

PERLDOC

  • UI::Dialog
  • UI::Dialog::GNOME
  • UI::Dialog::Backend
  • UI::Dialog::Backend::Nautilus
  • UI::Dialog::Backend::XOSD

MAN FILES


πŸ› BUGS πŸ›

Please email the author with any bug reports. Include the name of the module in the subject line. (fr fr, put the module name in the subject or it gets lost in the void πŸ˜­πŸ“¬)


πŸ‘‘ AUTHOR πŸ‘‘

Kevin C. Krinke, <kevin@krinke.ca>


Copyright (C) 2004-2016 Kevin C. Krinke <kevin@krinke.ca>

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 a wrap, bestie πŸŽ€βœ¨ This page is User Contributed Perl Documentation for perl v5.28.0, dated 2018-10-27. Go forth and treeview responsibly πŸ’…πŸŒΈ

πŸ“¦ where this page comes from