Padre::Wx::Role::Dialog - Allow dialogs or frames to host simple common dialogs
package MyDialog; use Padre::Wx (); use Padre::Wx::Role::Dialog (); @ISA = qw{ Padre::Wx::Role::Dialog Wx::Dialog }; # ... sub foo { my $self = shift; # Say something $self->message("Hello World!"); return 1; }
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.
Padre::Wx::Role::Dialog
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.
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.
$text
$title
Message
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.
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.
To install Padre, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Padre
CPAN shell
perl -MCPAN -e shell install Padre
For more information on module installation, please visit the detailed CPAN module installation guide.