User Tools

Site Tools


code:windows:filedialog

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
code:windows:filedialog [2011/01/29 18:55] jmgrcode:windows:filedialog [2011/04/20 20:31] (current) – removed jmgr
Line 1: Line 1:
-====== FileDialog ====== 
-This object represents a window allowing the user to choose a file. 
  
-===== Functions ===== 
- 
-==== FileDialog ==== 
-Constructor function. 
- 
-=== Syntax === 
-<code javascript> 
-var myObject = new FileDialog(); 
-</code> 
-<code javascript> 
-var myObject = new FileDialog(parameters); 
-</code> 
- 
-=== Arguments === 
-  - parameters - (object) window parameters 
-    * title - (string) the window's title 
-    * position - ([[code:core:point|Point]]) the window's position 
-    * opacity - (float) the window's opacity 
-    * enabled - (boolean) the window's enabled status 
-    * visible - (boolean) the window's visible status 
-    * acceptMode - ([[#acceptmode|AcceptMode]]) the file accept mode 
-    * fileMode - ([[#filemode|FileMode]]) the file mode 
-    * viewMode - ([[#viewmode|ViewMode]]) the view mode 
-    * selectedFile - (string) the default selected file 
-    * selectedNameFilter - (string) the default selected name filter 
-    * defaultSuffix - (string) the default file suffix 
-    * directory - (string) the default directory 
-    * filter - ([[#filter|Filter]]) the filter 
-    * nameFilter - (string) the name filter 
-    * nameFilters - (array) an array of name filters to use 
-    * showDirectoriesOnly - (boolean) show directories only 
-    * dontResolveSymlinks - (boolean) do not resolve symbolic links (Linux only) 
-    * dontConfirmOverwrite - (boolean) do not confirm overwrite 
-    * dontUseNativeDialog - (boolean) do not use the native dialog 
-    * readOnly - (boolean) show read-only files (Windows only) 
-    * hideNameFilterDetails - (boolean) hide the name filter details 
-    * sidebarUrls - (array) an array of urls shown on the side bar 
-    * onClosed - ([[#onclosed|OnClosed]] event called when the window is closed 
-    * onCurrentChanged - ([[#oncurrentchanged|OnCurrentChanged]] event called when the current selection changed 
-    * onDirectoryEntered - ([[#ondirectoryentered|OnDirectoryEntered]] event called when the current directory changed 
-    * onFileSelected - ([[#onfileselected|OnFileSelected]] event called when the window is closed 
-    * onFileSelected - ([[#onfilesselected|OnFilesSelected]] event called when the window is closed 
-    * onFilterSelected - ([[#onfilterselected|OnFilterSelected]] event called when a filter is selected 
- 
-=== Exceptions === 
-  * (ParameterTypeError) incorrect parameter type 
-  * (ParameterCountError) incorrect parameter count 
- 
-=== Example === 
-<code javascript> 
-var myObject = new FileDialog(); 
-</code> 
-<code javascript> 
-var myObject = new FileDialog({ 
- title: "Select a file", 
- acceptMode: FileDialog.Open 
-}); 
-</code> 
- 
-===== Methods ===== 
- 
-==== setTitle ==== 
-Sets the window's title. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setTitle(title); 
-</code> 
- 
-=== Arguments === 
-  - title - (string) the window's title 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setPosition ==== 
-Sets the window's position. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setPosition(point); 
-</code> 
- 
-=== Arguments === 
-  - point - ([[code:core:point|Point]]) the window's position 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setOpacity ==== 
-Sets the window's opacity. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setOpacity(opacity); 
-</code> 
- 
-=== Arguments === 
-  - opacity - (float) the window's opacity 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setEnabled ==== 
-Sets the window's enabled status. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setEnabled(enabled); 
-</code> 
- 
-=== Arguments === 
-  - enabled - (boolean) the window's enabled status 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setVisible ==== 
-Sets the window's visible status. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setVisible(visible); 
-</code> 
- 
-=== Arguments === 
-  - visible - (boolean) the window's visible status 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== close ==== 
-Closes the window. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.close(); 
-</code> 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== title ==== 
-Returns the window's title. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.title(); 
-</code> 
- 
-=== Returns === 
-  * (string) the window's title 
- 
-==== position ==== 
-Returns the window's position. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.position(); 
-</code> 
- 
-=== Returns === 
-  * ([[code:core:point|Point]]) the window's position 
- 
-==== opacity ==== 
-Returns the window's opacity. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.opacity(); 
-</code> 
- 
-=== Returns === 
-  * (float) the window's opacity 
- 
-==== enabled ==== 
-Returns the window's enabled status. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.enabled(); 
-</code> 
- 
-=== Returns === 
-  * (boolean) the window's enabled status 
- 
-==== visible ==== 
-Returns the window's visible status. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.visible(); 
-</code> 
- 
-=== Returns === 
-  * (boolean) the window's visible status 
- 
-==== setAcceptMode ==== 
-Sets the accept mode. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setAcceptMode(acceptMode); 
-</code> 
- 
-=== Arguments === 
-  - acceptMode - ([[#acceptmode|AcceptMode]]) the accept mode 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setFileMode ==== 
-Sets the file mode. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setFileMode(fileMode); 
-</code> 
- 
-=== Arguments === 
-  - fileMode - ([[#filemode|FileMode]]) the file mode 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setViewMode ==== 
-Sets the view mode. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setViewMode(viewMode); 
-</code> 
- 
-=== Arguments === 
-  - viewMode - ([[#viewmode|ViewMode]]) the view mode 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setLabelText ==== 
-Sets a label text. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setLabelText(dialogLabel, text); 
-</code> 
- 
-=== Arguments === 
-  - dialogLabel - ([[#dialoglabel|DialogLabel]]) the dialog label 
-  - text - (string) the label text 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== selectFile ==== 
-Selects a file. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.selectFile(filename); 
-</code> 
- 
-=== Arguments === 
-  - filename - (string) the file to select 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== selectNameFilter ==== 
-Selects the name filter. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.selectNameFilter(filter); 
-</code> 
- 
-=== Arguments === 
-  - filter - (string) the name filter 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setDefaultSuffix ==== 
-Selects the default suffix. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setDefaultSuffix(defaultSuffix); 
-</code> 
- 
-=== Arguments === 
-  - defaultSuffix - (string) the default suffix 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setDirectory ==== 
-Selects the current directory. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setDirectory(directory); 
-</code> 
- 
-=== Arguments === 
-  - directory - (string) the current directory 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setFilter ==== 
-Sets the filters. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setFilter(filters); 
-</code> 
- 
-=== Arguments === 
-  - filters - ([[#filters|Filters]]) the filters to use 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setNameFilter ==== 
-Sets the name filter. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setNameFilter(nameFilter); 
-</code> 
- 
-=== Arguments === 
-  - nameFilter - (string) the name filter 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setNameFilters ==== 
-Sets the name filters. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setNameFilters(nameFilters); 
-</code> 
- 
-=== Arguments === 
-  - nameFilters - (array) an array of name filters to use 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setShowDirectoriesOnly ==== 
-Should the window show directories. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setShowDirectoriesOnly(showDirectoriesOnly); 
-</code> 
- 
-=== Arguments === 
-  - showDirectoriesOnly - (boolean) show directories only 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setDontResolveSymlinks ==== 
-Should the window resolve symbolic links. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setDontResolveSymlinks(dontResolveSymlinks); 
-</code> 
- 
-=== Arguments === 
-  - dontResolveSymlinks - (boolean) resolve symbolic links 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setDontConfirmOverwrite ==== 
-Should the window ask for confirmation when overwriting a file. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setDontConfirmOverwrite(dontConfirmOverwrite); 
-</code> 
- 
-=== Arguments === 
-  - dontConfirmOverwrite - (boolean) ask for confirmation when overwriting a file 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setDontUseNativeDialog ==== 
-Should the window use native a dialog. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setDontUseNativeDialog(dontUseNativeDialog); 
-</code> 
- 
-=== Arguments === 
-  - dontUseNativeDialog - (boolean) use native a dialog 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setReadOnly ==== 
-Should the window show readonly files. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setReadOnly(readOnly); 
-</code> 
- 
-=== Arguments === 
-  - readOnly - (boolean) show readonly files 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setHideNameFilterDetails ==== 
-Hide name filter details. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setHideNameFilterDetails(hideNameFilterDetails); 
-</code> 
- 
-=== Arguments === 
-  - hideNameFilterDetails - (boolean) hide name filter details 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== setSidebarUrls ==== 
-Sets the sidebar urls. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.setSidebarUrls(sidebarUrls); 
-</code> 
- 
-=== Arguments === 
-  - sidebarUrls - (array) the sidebar urls 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== selectedFile ==== 
-Returns the selected file. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.selectedFile(); 
-</code> 
- 
-=== Returns === 
-  * (string) the selected file 
- 
-==== selectedFiles ==== 
-Returns the selected files. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.selectedFiles(); 
-</code> 
- 
-=== Returns === 
-  * (array) the selected files 
- 
-==== selectedNameFilter ==== 
-Returns the name filter. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.selectedNameFilter(); 
-</code> 
- 
-=== Returns === 
-  * (string) the selected name filter 
- 
-==== selectedNameFilter ==== 
-Returns the name filter. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.selectedNameFilter(); 
-</code> 
- 
-=== Returns === 
-  * (string) the selected name filter 
- 
-==== show ==== 
-Show the window. (non-blocking) 
-Use the [[#onclosed|OnClosed]] event to know when the window has been closed. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.show(); 
-</code> 
- 
-=== Returns === 
-  * (FileDialog) this FileDialog 
- 
-==== showModal ==== 
-Show the window. (blocking) 
- 
-=== Syntax === 
-<code javascript> 
-myObject.showModal(); 
-</code> 
- 
-=== Returns === 
-  * (integer) the window result (0 means that it has been canceled) 
- 
-===== Events ===== 
- 
-==== onClosed ==== 
-Called when the window is closed. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.onClosed = function(result) {}; 
-</code> 
- 
-=== Arguments === 
-  - result - (integer) the window result (0 means that it has been canceled) 
- 
-=== Example === 
-<code javascript> 
-myObject.onClosed = function(result) 
-{ 
- if(result) 
- { 
- //Event action 
- } 
-}; 
-</code> 
- 
-==== onCurrentChanged ==== 
-Called when the current file has changed. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.onCurrentChanged = function(path) {}; 
-</code> 
- 
-=== Arguments === 
-  - path - (string) the current file 
- 
-=== Example === 
-<code javascript> 
-myObject.onCurrentChanged = function(path) 
-{ 
- //Event action 
-}; 
-</code> 
- 
-==== onDirectoryEntered ==== 
-Called when the current directory has changed. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.onDirectoryEntered = function(directory) {}; 
-</code> 
- 
-=== Arguments === 
-  - directory - (string) the current file 
- 
-=== Example === 
-<code javascript> 
-myObject.onDirectoryEntered = function(directory) 
-{ 
- //Event action 
-}; 
-</code> 
- 
-==== onFileSelected ==== 
-Called when the dialog is accepted. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.onFileSelected = function(file) {}; 
-</code> 
- 
-=== Arguments === 
-  - file - (string) the selected file 
- 
-=== Example === 
-<code javascript> 
-myObject.onFileSelected = function(file) 
-{ 
- //Event action 
-}; 
-</code> 
- 
-==== onFilesSelected ==== 
-Called when the dialog is accepted. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.onFilesSelected = function(files) {}; 
-</code> 
- 
-=== Arguments === 
-  - files - (array) the selected files, as an array containing filenames 
- 
-=== Example === 
-<code javascript> 
-myObject.onFilesSelected = function(files) 
-{ 
- //Event action 
-}; 
-</code> 
- 
-==== onFilterSelected ==== 
-Called when the filter is changed. 
- 
-=== Syntax === 
-<code javascript> 
-myObject.onFilterSelected = function(filter) {}; 
-</code> 
- 
-=== Arguments === 
-  - filter - (string) the new filter 
- 
-=== Example === 
-<code javascript> 
-myObject.onFilterSelected = function(filter) 
-{ 
- //Event action 
-}; 
-</code> 
- 
-===== Attributes ===== 
- 
-==== title ==== 
-The window's title. (string) 
- 
-==== position ==== 
-The window's position. ([[code:core:point|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 === 
-  - Open: the dialog is used to open a file 
-  - Save: the dialog is used to save to a file 
- 
-==== FileMode ==== 
-Sets the file mode of the window. 
- 
-=== Values === 
-  - AnyFile: the selected file has not to exist to be selected 
-  - ExistingFile: there is only one file that can be selected and it has to exist 
-  - ExistingFiles: zero or more existing file can be selected 
-  - Directory: a directory can be selected 
- 
-==== ViewMode ==== 
-Sets the view mode of the window. 
- 
-=== Values === 
-  - Detail: show files with details 
-  - List: show only the file name and icon 
- 
-==== DialogLabel ==== 
-The label of the window to edit. 
- 
-=== Values === 
-  - LookIn: the "look in" label 
-  - FileName: the filename label 
-  - FileType: the filetype label 
-  - Accept: the accept label 
-  - Reject: the reject label 
- 
-==== Filters ==== 
-The filters to use. 
- 
-=== Values === 
-  - Dirs: list directories 
-  - AllDirs: list all directories without applying filters to directory names 
-  - Files: list files 
-  - Drives: list drives (Windows only) 
-  - NoSymLinks: do not list symbolic links (Linux only) 
-  - NoDotAndDotDot: do not list the special entries . and .. 
-  - NoDot: do not list the special entry . 
-  - NoDotDot: do not list the special entry .. 
-  - AllEntries: list directories, files and drives (same as Dirs | Files | Drives) 
-  - Readable: list readable files 
-  - Writable: list writable files 
-  - Executable: list executable files 
-  - Modified: list modified files (Windows only) 
-  - Hidden: list hidden files (on Linux, files starting with a dot) 
-  - System: list system files 
-  - 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 : 
-<code javascript> 
-myObject.setFilter(FileDialog.Files | FileDialog.Executable); //List only files that are executable 
-</code> 
code/windows/filedialog.1296327313.txt.gz · Last modified: 2021/02/13 11:23 (external edit)