NAME

Prima::Dialog::FileDialog - File system-related widgets and dialogs

SYNOPSIS

# open file
use Prima qw(Application Dialog::FileDialog);

my $open = Prima::Dialog::OpenDialog-> new(
	filter => [
		['Perl modules' => '*.pm'],
		['All' => '*']
	]
);
print $open-> fileName, " is to be opened\n" if $open-> execute;

# save file
my $save = Prima::Dialog::SaveDialog-> new(
	fileName => $open-> fileName,
);
print $save-> fileName, " is to be saved\n" if $save-> execute;

# open several files
$open-> multiSelect(1);
print $open-> fileName, " are to be opened\n" if $open-> execute;

DESCRIPTION

The module contains standard open file, save file, and change directory dialogs; plus special widgets for file and drive selection that are used in the dialogs

Prima::DirectoryListBox

A directory list box. Shows the list of subdirectories.

Properties

closedGlyphs INTEGER

The number of horizontal equal-width images, contained in the closedIcon property.

Default value: 1

closedIcon ICON

Provides the icon for the directories contained in the current directory.

indent INTEGER

A positive integer number of pixels, the offset of the hierarchy outline.

Default value: 12

openedGlyphs INTEGER

The number of horizontal equal-width images, contained in the openedIcon property.

Default value: 1

openedIcon OBJECT

Provides the icon for the directories contained above the current directory.

path STRING

Runtime-only property. Selects the file path.

showDotDirs BOOLEAN

Selects if the directories with the first dot character are shown. The dot-prefixed files are traditionally hidden in unix, so under Windows, this property is not useful.

Default value: 1

Methods

files FILE_TYPE

Returns the list of files filtered by FILE_TYPE. The FILE_TYPE is a string, one of those returned by Prima::Utils::getdir ( see "getdir" in Prima::Utils.

Prima::DriveComboBox

Drive selector combo-box for non-unix systems

Properties

firstDrive DRIVE_LETTER

Create-only property.

Default value: 'A:'

DRIVE_LETTER can be set to another value to start the drive enumeration. Some OSes can probe eventual diskette drives inside the drive enumeration routines, so it might be reasonable to set DRIVE_LETTER to the C: string for responsiveness increase.

drive DRIVE_LETTER

Selects the drive letter.

Default value: 'C:'

Prima::Dialog::FileDialog

Provides the standard file dialog where the user can navigate in the file system and select one or many files. The class can operate in two modes - 'open' and 'save'; these modes are triggered internally by Prima::Dialog::OpenDialog and Prima::Dialog::SaveDialog. Some properties behave differently depending on the mode that is stored in the openMode property.

Properties

createPrompt BOOLEAN

If 1, and the selected file is nonexistent, asks the user if the file is to be created.

Only actual when openMode is 1.

Default value: 0

defaultExt STRING

Selects the file extension, appended to the file name typed by the user, if the extension is not given.

Default value: ''

directory STRING

Selects the currently selected directory

fileMustExist BOOLEAN

If 1, ensures that the file typed by the user exists before closing the dialog.

Default value: 1

fileName STRING, ...

For the single-file selection, assigns the selected file name. For the multiple-file selection, on get-calls returns a list of the selected files; on set-calls accepts a single string where the file names are separated by the space character. The eventual space characters must be quoted.

filter ARRAY

Contains an array of arrays of string pairs, where each pair describes a file type. The first scalar in the pair is the description of the type; the second is a file mask.

Default value: [[ 'All files' => '*']]

filterIndex INTEGER

Selects the index in the filter array, which is the currently selected file type.

multiSelect BOOLEAN

Selects whether the user can select several ( 1 ) or one ( 0 ) file.

See also: fileName.

noReadOnly BOOLEAN

If 1, fails to open a file when it is read-only.

Default value: 0

Only actual when openMode is 0.

noTestFileCreate BOOLEAN

If 0, tests if a file that the user selected can be created.

Default value: 0

Only actual when openMode is 0.

overwritePrompt BOOLEAN

If 1, asks the user if the file selected is to be overwritten.

Default value: 1

Only actual when openMode is 0.

openMode BOOLEAN

Create-only property.

Selects whether the dialog operates in 'open' ( 1 ) mode or 'save' ( 0 ) mode.

pathMustExist BOOLEAN

If 1, ensures that the path typed by the user exists before closing the dialog.

Default value: 1

showDotFiles BOOLEAN

Selects if the directories with the first dot character are shown.

Default value: 0

showHelp BOOLEAN

A create-only property. If 1, the 'Help' button is inserted in the dialog.

Default value: 0

sorted BOOLEAN

Selects whether the file list appears sorted by name ( 1 ) or not ( 0 ).

Default value : 1

system BOOLEAN

A create-only property. If set to 1, Prima::Dialog::FileDialog returns an instance of the Prima::sys::XXX::FileDialog system-specific file dialog, if available for the XXX platform.

The system property knows only how to map the FileDialog, OpenDialog, and SaveDialog classes onto the system-specific file dialog classes; the inherited classes are not affected and cannot be replaced by the system dialog.

Methods

reread

Re-reads the currently selected directory.

Prima::Dialog::OpenDialog

A descendant of Prima::Dialog::FileDialog tuned for open-dialog functionality.

Prima::Dialog::SaveDialog

A descendant of Prima::Dialog::FileDialog tuned for save-dialog functionality.

Prima::Dialog::ChDirDialog

Provides standard dialog with interactive directory selection.

Properties

directory STRING

Selects the directory

showDotDirs

Selects if the directories with the first dot character are shown

Default value: 0

showHelp

Create-only property. If 1, the 'Help' button is inserted in the dialog.

Default value: 0

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima, Prima::Window, Prima::Lists, examples/drivecombo.pl, examples/launch.pl.