The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Padre::Wx::Role::Dialog - Allow dialogs or frames to host simple common dialogs

SYNOPSIS

package MyDialog;
use Padre::Wx ();
@ISA = qw{
Padre::Wx::Role::Dialog
Wx::Dialog
};
# ...
sub foo {
my $self = shift;
# Say something
$self->message("Hello World!");
return 1;
}

DESCRIPTION

In a large Wx application with multiple dialogs or windows, many different parts of the application may want to post messages or prompt the user.

The Padre::Wx::Role::Dialog role allows dialog or window classes to "host" these messages.

Providing these as a role means that each part of your application can post messages and have the positioning of the dialogs be made appropriate for each dialog.

METHODS

message

$parent->message( $text, $title );

Open a dialog box with $text as the main text and $title (title defaults to Message). There's only one OK button. No return value.

error

$parent->error( $text );

Open an error dialog box with $text as main text. There's only one OK button. No return value.

password

my $password = $parent->password( $message, $title );

Generate a standard Wx password dialog, using the internal Wx::PasswordEntryDialog class.

yes_no

my $boolean = $parent->yes_no(
$message,
$title,
);

Generates a standard Wx Yes/No dialog.

single_choice

my $choice = $parent->single_choice(
$message,
$title,
[
'Option One',
'Option Two',
'Option Three',
],
);

Generates a standard Wx single-choice dialog, using the standard internal Wx::SingleChoiceDialog class.

Returns the selected string, or undef if the user selects Cancel.

multi_choice

my @choices = $parent->multi_choice(
$message,
$title,
[
'Option One',
'Option Two',
'Option Three',
],
);

Generates a standard Wx multi-choice dialog, using the internal Wx::MultiChoiceDialog class.

COPYRIGHT & LICENSE

Copyright 2008-2016 The Padre development team as listed in Padre.pm.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

The full text of the license can be found in the LICENSE file included with this module.