1Padre::Wx::Role::DialogU(s3e)r Contributed Perl DocumentaPtaidorne::Wx::Role::Dialog(3)
2
3
4
6 Padre::Wx::Role::Dialog - Allow dialogs or frames to host simple common
7 dialogs
8
10 package MyDialog;
11
12 use Padre::Wx ();
13 use Padre::Wx::Role::Dialog ();
14
15 @ISA = qw{
16 Padre::Wx::Role::Dialog
17 Wx::Dialog
18 };
19
20 # ...
21
22 sub foo {
23 my $self = shift;
24
25 # Say something
26 $self->message("Hello World!");
27
28 return 1;
29 }
30
32 In a large Wx application with multiple dialogs or windows, many
33 different parts of the application may want to post messages or prompt
34 the user.
35
36 The "Padre::Wx::Role::Dialog" role allows dialog or window classes to
37 "host" these messages.
38
39 Providing these as a role means that each part of your application can
40 post messages and have the positioning of the dialogs be made
41 appropriate for each dialog.
42
44 "message"
45 $parent->message( $text, $title );
46
47 Open a dialog box with $text as the main text and $title (title
48 defaults to "Message"). There's only one OK button. No return value.
49
50 "error"
51
52 $parent->error( $text );
53
54 Open an error dialog box with $text as main text. There's only one OK
55 button. No return value.
56
57 "password"
58
59 my $password = $parent->password( $message, $title );
60
61 Generate a standard Wx password dialog, using the internal
62 Wx::PasswordEntryDialog class.
63
64 "yes_no"
65
66 my $boolean = $parent->yes_no(
67 $message,
68 $title,
69 );
70
71 Generates a standard Wx Yes/No dialog.
72
73 "single_choice"
74
75 my $choice = $parent->single_choice(
76 $message,
77 $title,
78 [
79 'Option One',
80 'Option Two',
81 'Option Three',
82 ],
83 );
84
85 Generates a standard Wx single-choice dialog, using the standard
86 internal Wx::SingleChoiceDialog class.
87
88 Returns the selected string, or "undef" if the user selects "Cancel".
89
90 "multi_choice"
91
92 my @choices = $parent->multi_choice(
93 $message,
94 $title,
95 [
96 'Option One',
97 'Option Two',
98 'Option Three',
99 ],
100 );
101
102 Generates a standard Wx multi-choice dialog, using the internal
103 Wx::MultiChoiceDialog class.
104
105
106
107perl v5.28.0 2011-08-16 Padre::Wx::Role::Dialog(3)