Dmitry Karasik > Prima-1.39 > Prima::FileDialog

Download:
Prima-1.39.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  2
Stalled  1
View/Report Bugs
Source  

NAME ^

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

SYNOPSIS ^

# open a file use Prima qw(Application); use Prima::StdDlg;

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

        # save a file
        my $save = Prima::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 widgets for file and drive selection, and also standard open file, save file, and change directory dialogs.

Prima::DirectoryListBox ^

A directory listing list box. Shows the list of subdirectories and upper directories, hierarchy-mapped, with the folder images and outlines.

Properties

closedGlyphs INTEGER

Number of horizontal equal-width images, contained in closedIcon property.

Default value: 1

closedIcon ICON

Provides an icon representation for the directories, contained in the current directory.

indent INTEGER

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

Default value: 12

openedGlyphs INTEGER

Number of horizontal equal-width images, contained in openedIcon property.

Default value: 1

openedIcon OBJECT

Provides an icon representation for the directories, contained in the directories above the current directory.

path STRING

Runtime-only property. Selects a file system path.

showDotDirs BOOLEAN

Selects if the directories with the first dot character are shown the view. The treatment of the dot-prefixed names as hidden is traditional to unix, and is of doubtful use under win32.

Default value: 1

Methods

files [ FILE_TYPE ]

If FILE_TYPE value is not specified, the list of all files in the current directory is returned. If FILE_TYPE is given, only the files of the types are returned. The FILE_TYPE is a string, one of those returned by Prima::Utils::getdir ( see "getdir" in Prima::Utils.

Prima::DriveComboBox ^

Provides drive selection combo-box for non-unix systems.

Properties

firstDrive DRIVE_LETTER

Create-only property.

Default value: 'A:'

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

drive DRIVE_LETTER

Selects the drive letter.

Default value: 'C:'

Prima::FileDialog ^

Provides a standard file dialog, allowing to navigate by the file system and select one or many files. The class can operate in two modes - 'open' and 'save'; these modes are set by Prima::OpenDialog and Prima::SaveDialog. Some properties behave differently depending on the mode, which is stored in openMode property.

Properties

createPrompt BOOLEAN

If 1, and a file selected 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 single-file selection, assigns the selected file name, For multiple-file selection, on get-call returns list of the selected files; on set-call, accepts a single string, where the file names are separated by the space character. The eventual space characters must be quoted.

filter ARRAY

Contains 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 filter array of 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 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 overwrittten.

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, types by the user, exists before closing the dialog.

Default value: 1

showDotFiles BOOLEAN

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

Default value: 0

showHelp BOOLEAN

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

Default value: 1

sorted BOOLEAN

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

Default value : 1

system BOOLEAN

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

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

Methods

reread

Re-reads the currently selected directory.

Prima::OpenDialog ^

Descendant of Prima::FileDialog, tuned for open-dialog functionality.

Prima::SaveDialog ^

Descendant of Prima::FileDialog, tuned for save-dialog functionality.

Prima::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 the view.

Default value: 0

showHelp

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

Default value: 1

AUTHOR ^

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

SEE ALSO ^

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

syntax highlighting: