Outils pour utilisateurs

Outils du site


fr:code:windows:filedialog

Ceci est une ancienne révision du document !


FileDialog [En cours de Traduction Wismerheal][WSL]

Cet objet représente une fenêtre permettant à l'utilisateur de choisir un fichier.

Fonctions

FileDialog

Fonction de construction.

Syntaxe

var myObject = new FileDialog();
var myObject = new FileDialog(parameters);

Arguments

  1. parameters - (object) paramètres de fenêtre
    • title - (string) e titre de la fenêtre
    • position - (Point) la position de la fenêtre
    • opacity - (float) l'opacité de la fenêtre
    • enabled - (boolean) le statut d'activation de la fenêtre
    • visible - (boolean) le statut de la fenêtre visible
    • acceptMode - (AcceptMode) le mode d'acceptation de fichier
    • fileMode - (FileMode) le mode de fichier
    • viewMode - (ViewMode) le mode de vue
    • selectedFile - (string) le fichier sélectionné par défaut
    • selectedNameFilter - (string) le nom du filtre sélectionné par défaut
    • defaultSuffix - (string) le suffixe de fichier par défaut
    • directory - (string) le répertoire par défaut
    • filter - (Filter) le filtre
    • nameFilter - (string) le nom du filtre
    • nameFilters - (array) un tableau de noms de filtres à utiliser
    • showDirectoriesOnly - (boolean) montrer seulement les répertoires
    • dontResolveSymlinks - (boolean) ne solutionne pas les liens symboliques (Linux seulement)
    • dontConfirmOverwrite - (boolean) ne confirme pas l'écrasement en écriture
    • dontUseNativeDialog - (boolean) n'utilise pas un "dialog" natif
    • readOnly - (boolean) show read-only files (Windows seulement)
    • hideNameFilterDetails - (boolean) cache les détails de nom de filtre
    • sidebarUrls - (array) un tableau d'urls affiché sur la barre du côté
    • onClosed - (OnClosed évènement appelé quand la fenêtre est fermée
    • onCurrentChanged - (OnCurrentChanged évènement appelé quand l'actuelle sélection est changée
    • onDirectoryEntered - (OnDirectoryEntered évènement appelé quand le répertoire actuel est changé
    • onFileSelected - (OnFileSelected évènement appelé quand la fenêtre est fermée
    • onFileSelected - (OnFilesSelected évènement appelé quand la fenêtre est fermée
    • onFilterSelected - (OnFilterSelected évènement appelé event quand un filtre est sélectionné

Exceptions

  • (ParameterTypeError) type de paramètre incorrect
  • (ParameterCountError) compte de paramètre incorrect

Example

var myObject = new FileDialog();
var myObject = new FileDialog({
	title: "Select a file",
	acceptMode: FileDialog.Open
});

Methods

setTitle

Sets the window's title.

Syntax

myObject.setTitle(title);

Arguments

  1. title - (string) the window's title

Returns

  • (FileDialog) this FileDialog

setPosition

Sets the window's position.

Syntax

myObject.setPosition(point);

Arguments

  1. point - (Point) the window's position

Returns

  • (FileDialog) this FileDialog

setOpacity

Sets the window's opacity.

Syntax

myObject.setOpacity(opacity);

Arguments

  1. opacity - (float) the window's opacity

Returns

  • (FileDialog) this FileDialog

setEnabled

Sets the window's enabled status.

Syntax

myObject.setEnabled(enabled);

Arguments

  1. enabled - (boolean) the window's enabled status

Returns

  • (FileDialog) this FileDialog

setVisible

Sets the window's visible status.

Syntax

myObject.setVisible(visible);

Arguments

  1. visible - (boolean) the window's visible status

Returns

  • (FileDialog) this FileDialog

close

Closes the window.

Syntax

myObject.close();

Returns

  • (FileDialog) this FileDialog

title

Returns the window's title.

Syntax

myObject.title();

Returns

  • (string) the window's title

position

Returns the window's position.

Syntax

myObject.position();

Returns

  • (Point) the window's position

opacity

Returns the window's opacity.

Syntax

myObject.opacity();

Returns

  • (float) the window's opacity

enabled

Returns the window's enabled status.

Syntax

myObject.enabled();

Returns

  • (boolean) the window's enabled status

visible

Returns the window's visible status.

Syntax

myObject.visible();

Returns

  • (boolean) the window's visible status

setAcceptMode

Sets the accept mode.

Syntax

myObject.setAcceptMode(acceptMode);

Arguments

  1. acceptMode - (AcceptMode) the accept mode

Returns

  • (FileDialog) this FileDialog

setFileMode

Sets the file mode.

Syntax

myObject.setFileMode(fileMode);

Arguments

  1. fileMode - (FileMode) the file mode

Returns

  • (FileDialog) this FileDialog

setViewMode

Sets the view mode.

Syntax

myObject.setViewMode(viewMode);

Arguments

  1. viewMode - (ViewMode) the view mode

Returns

  • (FileDialog) this FileDialog

setLabelText

Sets a label text.

Syntax

myObject.setLabelText(dialogLabel, text);

Arguments

  1. dialogLabel - (DialogLabel) the dialog label
  2. text - (string) the label text

Returns

  • (FileDialog) this FileDialog

selectFile

Selects a file.

Syntax

myObject.selectFile(filename);

Arguments

  1. filename - (string) the file to select

Returns

  • (FileDialog) this FileDialog

selectNameFilter

Selects the name filter.

Syntax

myObject.selectNameFilter(filter);

Arguments

  1. filter - (string) the name filter

Returns

  • (FileDialog) this FileDialog

setDefaultSuffix

Selects the default suffix.

Syntax

myObject.setDefaultSuffix(defaultSuffix);

Arguments

  1. defaultSuffix - (string) the default suffix

Returns

  • (FileDialog) this FileDialog

setDirectory

Selects the current directory.

Syntax

myObject.setDirectory(directory);

Arguments

  1. directory - (string) the current directory

Returns

  • (FileDialog) this FileDialog

setFilter

Sets the filters.

Syntax

myObject.setFilter(filters);

Arguments

  1. filters - (Filters) the filters to use

Returns

  • (FileDialog) this FileDialog

setNameFilter

Sets the name filter.

Syntax

myObject.setNameFilter(nameFilter);

Arguments

  1. nameFilter - (string) the name filter

Returns

  • (FileDialog) this FileDialog

setNameFilters

Sets the name filters.

Syntax

myObject.setNameFilters(nameFilters);

Arguments

  1. nameFilters - (array) an array of name filters to use

Returns

  • (FileDialog) this FileDialog

setShowDirectoriesOnly

Should the window show directories.

Syntax

myObject.setShowDirectoriesOnly(showDirectoriesOnly);

Arguments

  1. showDirectoriesOnly - (boolean) show directories only

Returns

  • (FileDialog) this FileDialog

Should the window resolve symbolic links.

Syntax

myObject.setDontResolveSymlinks(dontResolveSymlinks);

Arguments

  1. dontResolveSymlinks - (boolean) resolve symbolic links

Returns

  • (FileDialog) this FileDialog

setDontConfirmOverwrite

Should the window ask for confirmation when overwriting a file.

Syntax

myObject.setDontConfirmOverwrite(dontConfirmOverwrite);

Arguments

  1. dontConfirmOverwrite - (boolean) ask for confirmation when overwriting a file

Returns

  • (FileDialog) this FileDialog

setDontUseNativeDialog

Should the window use native a dialog.

Syntax

myObject.setDontUseNativeDialog(dontUseNativeDialog);

Arguments

  1. dontUseNativeDialog - (boolean) use native a dialog

Returns

  • (FileDialog) this FileDialog

setReadOnly

Should the window show readonly files.

Syntax

myObject.setReadOnly(readOnly);

Arguments

  1. readOnly - (boolean) show readonly files

Returns

  • (FileDialog) this FileDialog

setHideNameFilterDetails

Hide name filter details.

Syntax

myObject.setHideNameFilterDetails(hideNameFilterDetails);

Arguments

  1. hideNameFilterDetails - (boolean) hide name filter details

Returns

  • (FileDialog) this FileDialog

setSidebarUrls

Sets the sidebar urls.

Syntax

myObject.setSidebarUrls(sidebarUrls);

Arguments

  1. sidebarUrls - (array) the sidebar urls

Returns

  • (FileDialog) this FileDialog

selectedFile

Returns the selected file.

Syntax

myObject.selectedFile();

Returns

  • (string) the selected file

selectedFiles

Returns the selected files.

Syntax

myObject.selectedFiles();

Returns

  • (array) the selected files

selectedNameFilter

Returns the name filter.

Syntax

myObject.selectedNameFilter();

Returns

  • (string) the selected name filter

selectedNameFilter

Returns the name filter.

Syntax

myObject.selectedNameFilter();

Returns

  • (string) the selected name filter

show

Show the window. (non-blocking) Use the OnClosed event to know when the window has been closed.

Syntax

myObject.show();

Returns

  • (FileDialog) this FileDialog

showModal

Show the window. (blocking)

Syntax

myObject.showModal();

Returns

  • (integer) the window result (0 means that it has been canceled)

Events

onClosed

Called when the window is closed.

Syntax

myObject.onClosed = function(result) {};

Arguments

  1. result - (integer) the window result (0 means that it has been canceled)

Example

myObject.onClosed = function(result)
{
	if(result)
	{
		//Event action
	}
};

onCurrentChanged

Called when the current file has changed.

Syntax

myObject.onCurrentChanged = function(path) {};

Arguments

  1. path - (string) the current file

Example

myObject.onCurrentChanged = function(path)
{
	//Event action
};

onDirectoryEntered

Called when the current directory has changed.

Syntax

myObject.onDirectoryEntered = function(directory) {};

Arguments

  1. directory - (string) the current file

Example

myObject.onDirectoryEntered = function(directory)
{
	//Event action
};

onFileSelected

Called when the dialog is accepted.

Syntax

myObject.onFileSelected = function(file) {};

Arguments

  1. file - (string) the selected file

Example

myObject.onFileSelected = function(file)
{
	//Event action
};

onFilesSelected

Called when the dialog is accepted.

Syntax

myObject.onFilesSelected = function(files) {};

Arguments

  1. files - (array) the selected files, as an array containing filenames

Example

myObject.onFilesSelected = function(files)
{
	//Event action
};

onFilterSelected

Called when the filter is changed.

Syntax

myObject.onFilterSelected = function(filter) {};

Arguments

  1. filter - (string) the new filter

Example

myObject.onFilterSelected = function(filter)
{
	//Event action
};

Attributes

title

The window's title. (string)

position

The window's position. (Point)

opacity

The window's opacity. (float)

enabled

The window's enabled status. (boolean)

visible

The window's visible status. (boolean)

Enumerations

AcceptMode

Sets the accept mode of the window.

Values

  1. Open: the dialog is used to open a file
  2. Save: the dialog is used to save to a file

FileMode

Sets the file mode of the window.

Values

  1. AnyFile: the selected file has not to exist to be selected
  2. ExistingFile: there is only one file that can be selected and it has to exist
  3. ExistingFiles: zero or more existing file can be selected
  4. Directory: a directory can be selected

ViewMode

Sets the view mode of the window.

Values

  1. Detail: show files with details
  2. List: show only the file name and icon

DialogLabel

The label of the window to edit.

Values

  1. LookIn: the "look in" label
  2. FileName: the filename label
  3. FileType: the filetype label
  4. Accept: the accept label
  5. Reject: the reject label

Filters

The filters to use.

Values

  1. Dirs: list directories
  2. AllDirs: list all directories without applying filters to directory names
  3. Files: list files
  4. Drives: list drives (Windows only)
  5. NoSymLinks: do not list symbolic links (Linux only)
  6. NoDotAndDotDot: do not list the special entries . and ..
  7. NoDot: do not list the special entry .
  8. NoDotDot: do not list the special entry ..
  9. AllEntries: list directories, files and drives (same as Dirs | Files | Drives)
  10. Readable: list readable files
  11. Writable: list writable files
  12. Executable: list executable files
  13. Modified: list modified files (Windows only)
  14. Hidden: list hidden files (on Linux, files starting with a dot)
  15. System: list system files
  16. CaseSensitive: the filter string should be case sensitive

Notes

This is a flag enumeration, this means that you can use multiple values using the | operator. Example :

myObject.setFilter(FileDialog.Files | FileDialog.Executable); //List only files that are executable
fr/code/windows/filedialog.1335441384.txt.gz · Dernière modification : 2021/02/13 11:23 (modification externe)