Skip to content

Commit

Permalink
add the dialog=>{} option
Browse files Browse the repository at this point in the history
  • Loading branch information
dk committed Jan 9, 2025
1 parent 3b2d02e commit 042d8b4
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions Prima/MsgBox.pm
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ sub message_box
onExecute => sub {
Prima::Utils::beep( $options) if $options && !$nosound;
},
%{$extras->{dialog} // {}},
);

my @btns = insert_buttons( $dlg, $buttons, $extras);
Expand Down Expand Up @@ -221,6 +222,7 @@ sub input_box
scaleChildren => 1,
visible => 0,
text => $title,
%{$extras->{dialog} // {}},
);

insert_buttons( $dlg, $buttons, $extras);
Expand Down Expand Up @@ -396,12 +398,36 @@ is too big to fit to the dialog window without scrolling.
Actual only for the message box, not for the input box.
=item buttons HASH
To modify a button, an integer key with the corresponding C<mb::XXX> constant
can be set with the hash reference under the C<buttons> key. The hash is the
profile passed to the button as creation parameters. For example, to change
the text and behavior of a button, the following construct can be used:
Prima::MsgBox::message( 'Hello', mb::OkCancel,
buttons => {
mb::Ok, {
text => '~Hello',
onClick => sub { Prima::message('Hello indeed!'); }
}
}
);
If it is not desired that the dialog must be closed when the user presses a
button, its C<::modalResult> property ( see L<Prima::Buttons> ) must be reset
to 0.
=item defButton INTEGER
Selects the default button in the dialog, i.e. the button that reacts on the
return key. Its value must be to an C<mb::> constant of the desired button. If
this option is not set, the leftmost button is selected as the default.
=item dialog HASH
An optional hash override the dialog properties
=item font FONT
The message boxes use C<Application.get_message_font>, but the C<font> option
Expand All @@ -419,26 +445,6 @@ Only for C<input_box>.
Contains the profile hash passed to the input line as creation parameters.
=item buttons HASH
To modify a button, an integer key with the corresponding C<mb::XXX> constant
can be set with the hash reference under the C<buttons> key. The hash is the
profile passed to the button as creation parameters. For example, to change
the text and behavior of a button, the following construct can be used:
Prima::MsgBox::message( 'Hello', mb::OkCancel,
buttons => {
mb::Ok, {
text => '~Hello',
onClick => sub { Prima::message('Hello indeed!'); }
}
}
);
If it is not desired that the dialog must be closed when the user presses a
button, its C<::modalResult> property ( see L<Prima::Buttons> ) must be reset
to 0.
=item owner WINDOW
If set, the dialog owner is set to WINDOW, otherwise to C<$::main_window>.
Expand Down

0 comments on commit 042d8b4

Please sign in to comment.