NAME
Chandra::Dialog - Native dialog boxes for Chandra applications
SYNOPSIS
use Chandra::App;
my $app = Chandra::App->new(title => 'My App');
# File open dialog
my $path = $app->dialog->open_file(title => 'Select a file');
print "Selected: $path\n" if defined $path;
# Directory picker
my $dir = $app->dialog->open_directory;
# Save dialog
my $save = $app->dialog->save_file(
title => 'Save As',
default => 'untitled.txt',
);
# Alert dialogs
$app->dialog->info(title => 'Done', message => 'File saved!');
$app->dialog->warning(message => 'Unsaved changes');
$app->dialog->error(message => 'Could not open file');
DESCRIPTION
Chandra::Dialog provides access to native platform dialog boxes via the underlying webview-c library. All dialogs are modal and block until the user responds.
File open and save dialogs return the selected path, or undef if the user cancelled.
METHODS
new(%args)
Create a new Dialog instance. Usually accessed via $app->dialog.
open_file(%opts)
Show a file-open dialog. Options:
Returns the selected file path, or undef if cancelled.
open_directory(%opts)
Show a directory picker. Options:
Returns the selected directory path, or undef if cancelled.
save_file(%opts)
Show a file-save dialog. Options:
Returns the chosen save path, or undef if cancelled.
info(%opts)
Show an informational alert. Options: title, message.
warning(%opts)
Show a warning alert. Options: title, message.
error(%opts)
Show an error alert. Options: title, message.
CONSTANTS
These are exported for advanced usage with the low-level $app->webview->dialog() XS method.