|
Class: FileDialog
Object
|
+--Model
|
+--ApplicationModel
|
+--SimpleDialog
|
+--FileDialog
|
+--FileDialogWithPreview
- Package:
- stx:libtool
- Category:
- Interface-Tools-File
- Version:
- rev:
1.195
date: 2024/03/19 09:08:14
- user: cg
- file: FileDialog.st directory: libtool
- module: stx stc-classLibrary: libtool
A slightly better file dialog
API of interest:
[class side] additionalFolderItemsInMenu
optional list of additional folders to be presented
in the directory menu.
If not empty, entries will be added to EVERY file dialog.
[instance side] additionalFolderItemsInMenu
optional list of additional folders to be presented in the directory menu.
If not empty, entries will be added to this file dialog.
[instance variables:]
[class variables:]
copyrightCOPYRIGHT (c) 2002 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
todo- make the filedialog windows like
filename entry field shows only the filename not the whole directory
the tree always starts in current directory
the parent tree is shown in a combobox where the perents are selectable
- do not expand the ~ or relative pathnames to absolute pathnames
accessing
-
additionalFolderItemsInMenu
-
any additional folders to be shown in the 'File' menu;
each element can be either a filename or a pair with filename and menu-item-label.
Usage example(s):
FileDialog additionalFolderItemsInMenu:#('/Users/exept' ('/Users/exept/cg_work' 'WorkDir'))
|
-
additionalFolderItemsInMenu: aCollectionOfFoldernames
-
any additional folders to be shown in every 'File' menu;
each element can be either a filename or a pair with filename and menu-item-label,
or an assoc, with key=filename and value=label.
Usage example(s):
FileDialog additionalFolderItemsInMenu:#('/Users/exept' ('/Users/exept/cg_work' 'WorkDir'))
|
-
additionalFoldersInDirectoryMenuQuery
-
can be answered with a list of addotional folders
(expecco does this to add eg/ the attach,emtsFolder(
Usage example(s):
FileDialog additionalFoldersInDirectoryMenuQuery
answer:#('/foo' '/bar')
do:[
Dialog requestFileName:'Enter filename'
]
|
-
classResources
-
(comment from inherited method)
if not already loaded, get the classes resourcePack and return it
-
lastExtent
-
marked as obsolete by exept MBP at 10-06-2023
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
lastExtent: anExtent
-
marked as obsolete by exept MBP at 10-06-2023
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
setDoubleClickActionFor: instance
-
help specs
-
helpSpec
-
This resource specification was automatically generated
by the UIHelpTool of ST/X.
instance creation
-
requestDirectoryName: title default: aFileName ifFail: failBlock
-
same as requestFileName, but only show directories
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ifFail:'none'
|
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText ifFail: failBlock
-
same as requestFileName, but only show directories
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ok:'Yes'
abort:'No'
ifFail:'none'
|
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText ifFail: failBlock acceptReturnAsOK: aBoolean
-
same as requestFileName, but only show directories
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ok:'Yes'
abort:'No'
ifFail:'none'
|
-
requestDirectoryName: titleString default: aFileName ok: okText abort: abortText version: versionSymbol pattern: patternArg fromDirectory: aDirectoryPath ifFail: failBlock whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
same as requestFileName, but only show directories
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ifFail:nil
|
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ok:nil
abort:nil
version:nil
pattern:nil
fromDirectory:nil
ifFail:nil
whenBoxCreatedEvaluate:nil
asLoadDialog:true
|
-
requestDirectoryName: title default: aFileName ok: okText ifFail: failBlock
-
same as requestFileName, but only show directories
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ok:'Yes'
ifFail:'none'
|
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil whenBoxCreatedEvaluate: boxCreatedCallback
-
-
requestFileName: titleString default: defaultName ok: okText abort: abortText version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
-
requestFileName: titleString default: defaultName ok: okText abort: abortText version: versionSymbol ifFail: failBlock pattern: patternArg fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
Usage example(s):
FileDialog
requestFileName:'enter a fileName:'
default:''
ok:nil
abort:nil
version:nil
ifFail:['none']
pattern:'*'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
asLoadDialog:true
|
-
requestFileName: titleString default: defaultName pattern: pattern fromDirectory: aDirectory
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show ok/cancel in its buttons.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
-
requestFileName: titleString default: defaultName version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPathOrNil whenBoxCreatedEvaluate: boxCreatedCallback
-
FileDialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil.
Dialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
Usage example(s):
FileDialog
requestFileName:'enter a fileName:'
default:''
version:#old
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
|
Usage example(s):
FileDialog
requestFileName:'enter a fileName:'
default:''
version:#mustBeNew
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
|
-
requestFileNames: titleString default: defaultName ok: okText abort: abortText ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed
Usage example(s):
FileDialog
requestFileNames:'enter a fileName:'
default:''
ok:nil
abort:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil.
|
-
requestFileNames: titleString default: defaultName ok: okText abort: abortText ifFail: failBlock pattern: patternArg fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: asLoadDialog
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed
Usage example(s):
FileDialog
requestFileNames:'enter a fileName:'
default:''
ok:nil
abort:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
asLoadDialog:true.
|
-
startApplicationFor: titleString default: initialDefaultFileNameArg ok: okTextArg abort: abortTextArg ifFail: failBlock pattern: patternArg fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: asLoadDialog viewFiles: viewFilesArg multipleSelect: multipleSelectArg
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
interface specs
-
windowSpec
-
This resource specification was automatically generated
by the UIPainter of ST/X.
Usage example(s):
UIPainter new openOnClass:FileDialog andSelector:#windowSpec
FileDialog new openInterface:#windowSpec
FileDialog open
|
menu specs
-
directoryMenu
-
This resource specification was automatically generated
by the MenuEditor of ST/X.
-
mainMenu
-
This resource specification was automatically generated
by the MenuEditor of ST/X.
Usage example(s):
MenuEditor new openOnClass:FileDialog andSelector:#mainMenu
(Menu new fromLiteralArrayEncoding:(FileDialog mainMenu)) startUp
|
-
toolBarMenu
-
This resource specification was automatically generated
by the MenuEditor of ST/X.
Usage example(s):
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp
|
-
viewInContentsBrowserMenu
-
plugIn spec
-
aspectSelectors
-
This resource specification was automatically generated
by the UIPainter of ST/X.
API
-
requestDirectoryName: titleString default: aFileName ok: okText abort: abortText version: versionSymbol pattern: patternArg fromDirectory: aDirectoryPath ifFail: failBlock whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
same as requestFileName, but only show directories
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ifFail:nil
|
Usage example(s):
FileDialog
requestDirectoryName:'which directory ?'
default:Filename currentDirectory pathName
ok:nil
abort:nil
version:nil
pattern:nil
fromDirectory:nil
ifFail:nil
whenBoxCreatedEvaluate:nil
asLoadDialog:true
|
-
requestFileName: titleString default: defaultName ok: okText abort: abortText version: versionSymbol ifFail: failBlock pattern: patternArg fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed (or an empty filename was entered)
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
Usage example(s):
FileDialog
requestFileName:'enter a fileName:'
default:''
ok:nil
abort:nil
version:nil
ifFail:['none']
pattern:'*'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
asLoadDialog:true
|
-
requestFileNames: titleString default: defaultName ok: okText abort: abortText ifFail: failBlock pattern: patternArg fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: asLoadDialog
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed
Usage example(s):
FileDialog
requestFileNames:'enter a fileName:'
default:''
ok:nil
abort:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:Filename currentDirectory pathName
whenBoxCreatedEvaluate:nil
asLoadDialog:true.
|
-
startApplicationFor: titleString default: initialDefaultFileNameArg ok: okTextArg abort: abortTextArg ifFail: failBlock pattern: patternArg fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: asLoadDialog viewFiles: viewFilesArg multipleSelect: multipleSelectArg
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to patternArg initially.
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
accessing
-
additionalFolderItemsInMenu: aCollectionOfFoldernames
-
any additional folders to be shown in this 'File' menu;
each element can be either a filename or a pair with filename and menu-item-label,
or an assoc, with key=filename and value=label.
-
appendWasPressed
-
valid after the dialog has been closed: true if append was pressed
-
currentSelectedFiles
-
-
directory
-
return the value of the instance variable 'directory' (automatically generated)
-
directory: something
-
set the value of the instance variable 'directory' (automatically generated)
-
initialText
-
-
initialText: something
-
-
pattern
-
return the value of the instance variable 'pattern' (automatically generated)
-
pattern: aString
-
set the matchpattern
-
result
-
return the value of the instance variable 'result' (automatically generated)
-
result: something
-
set the value of the instance variable 'result' (automatically generated)
-
selectedDirectories
-
-
startFilename
-
-
startFilename: something
-
accessing-behavior
-
asLoadDialog
-
marked as obsolete by mobile at 03-08-2023
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
asLoadDialog: aBoolean
-
marked as obsolete by mobile at 03-08-2023
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
beLoadDialog: aBoolean
-
-
doubleClickAction
-
return the value of the instance variable 'doubleClickAction' (automatically generated)
-
doubleClickAction: something
-
set the value of the instance variable 'doubleClickAction' (automatically generated)
-
isLoadDialog
-
-
multipleSelect
-
-
multipleSelect: aBoolean
-
accessing-components
-
addButton: aButton
-
-
okButton
-
-
treeBrowser
-
return the value of the instance variable 'treeBrowser' (automatically generated)
-
verticalPanel
-
accessing-look
-
hideButtonPanel
-
-
showButtonPanel
-
-
viewFiles
-
if true, files can be selected; if false, only directories
-
viewFiles: aBoolean
-
if true, files can be selected; if false, only directories
aspects
-
appendButtonVisibleHolder
-
if set, an additional 'append' button is shown
(to let user append to a file, instead of overwriting the file)
-
appendLabelHolder
-
-
aspectOrNil: aKey forSubApplication: aSubApp
-
this hook provides an aspect for a subApp
-
browseMenuItemVisible: aBoolean
-
controls if an 'open filebrowser' menu item is to be shown in the toolbar
-
browseMenuItemVisibleHolder
-
controls if an 'open filebrowser' menu item is to be shown in the toolbar
-
buttonPanelVisibleHolder
-
-
cancelLabelHolder
-
-
enableBack
-
-
enableDirectoryUp
-
-
enableForward
-
-
enableGotoDesktopDirectory
-
-
enableGotoDocuments
-
-
enableGotoDownloads
-
-
enableHome
-
-
fileEntryFieldHolder
-
for directoryTreeBrowser
-
filenameHolder
-
Return a value holder with the filename.
Shown in the filename input-field.
Being the selection in the tree.
-
filenameHolder: aHolder
-
needed when used as subcanvas
-
filenameLabelHolder
-
Return a value holder for the input string.
-
filterHolder
-
Return a value holder for filter
-
filterHolder: aHolder
-
needed when used as subcanvas
-
gotoBookmarksMenu
-
|menu bookmarks|
-
listOfDeviceDrives
-
-
newDirectoryVisibilityHolder
-
-
okLabelEnabled
-
-
okLabelHolder
-
-
rootDirectoryHolder
-
Return a value holder for filter
-
rootDirectoryHolder: aHolder
-
Return a value holder for filter
-
searchInfoBoxVisibleHolder
-
set during search-file operation
-
searchedDirectoryInfoHolder
-
updated during search-file operation
-
selectedDeviceDrive
-
-
showDirectoryTree
-
-
showDiskUsageHolder
-
-
showHiddenFiles
-
-
shownFiles
-
-
sortCaseless
-
aspect for sort caseless
-
sortCaselessInTreeBrowser
-
only for backward compat.
We do not need two such flags
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
sortInTreeVisibilityHolder
-
-
sortPropertyInTree
-
-
viewDirsInContentsBrowser
-
-
viewFilesInDirectoryTree
-
-
viewNoteBookApplicationHolder
-
change & update
-
buttonPanelVisibilityChanged
-
force resize
-
fileSelectionChanged
-
the name in the entry field
-
selectedDeviceDriveChanged
-
Filename defaultVolumeName.
-
update: something with: aParameter from: changedObject
-
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:
construction-adding
-
addComponent: aView
-
event handling
-
processEvent: anEvent
-
filter keyboard edit-events typed into the listOfItemsView.
Return true, if I have eaten the event
initialization & release
-
commonPostOpen
-
self windowGroup addPreEventHook:self.
-
initialRootDirectory
-
returns the directory the browser is open on
-
initialize
-
false
-
postBuildFileNameField: aWidget
-
-
postBuildFilterField: aWidget
-
-
postBuildTreeBrowser: aSubCanvasView
-
-
postBuildVerticalPanelView: aView
-
-
postBuildWith: aBuilder
-
minExtent is nil if window is not a TopView
-
postOpenAsSubcanvasWith: aBuilder
-
No ok and cancel buttons, when dialog is part of a larger dialog
-
preOpenWith: aBuilder
-
called right before being opened
-
rememberExtent
-
marked as obsolete by exept MBP at 10-06-2023
** This is an obsolete interface - do not use it (it may vanish in future versions) **
menus
-
additionalFoldersMenuSlice
-
AdditionalFolderItemsInMenu := #('/foo' '/etc' '/Users')
-
additionalFoldersMenuSliceHolder
-
-
bookmarksMenu
-
-
directoryMenu
-
-
showMenuSpecForDialog
-
-
sortMenu
-
-
visitedDirectoriesMenu
-
private
-
returnWasPressedInFilterField
-
ev targetView isSameOrComponentOf:filenameField
-
returnWasPressedInFilterOrFilenameField
-
ev targetView isSameOrComponentOf:filenameField
queries
-
driveSelectorVisible
-
user actions
-
appendPressed
-
-
commonAcceptAction
-
-
doAccept
-
force accept - ignore in filterField
-
doBack
-
-
doBrowseDirectory
-
-
doCancel
-
(comment from inherited method)
force cancel
-
doFindAndSelectFile
-
search for a file matching a requested pattern
-
doFindAndSelectNextFile
-
search the next file matching the previous pattern
-
doForward
-
-
doGoDirectoryUp
-
-
doGotoDesktopDirectory
-
-
doGotoDocumentsDirectory
-
-
doGotoDownloadsDirectory
-
-
doGotoHomeDirectory
-
-
expandSelectionIfShowingFiles
-
-
findAndSelectNextFileEnabledHolder
-
-
gotoFile: fn
-
-
menuDirHistory: backOrForward
-
-
menuDirHistoryBack
-
-
menuDirHistoryForward
-
-
newDirectory
-
forward to the treebrowser component, which already has this functionality
-
okPressed
-
-
openTerminal
-
forward to the treebrowser component, which already has this functionality
-
tabPressedInFilenameField
-
-
updateCurrentDirectory
-
AdditionalFoldersInDirectoryMenuQuery
usually direct access to FileDialog is not recommended;
please use the Dialog interface, which is able to dispatch to
alternative file choosers if the settings say so
(native dialogs, for example):
|fileOrNil|
fileOrNil := Dialog requestFileName:'Choose a File'.
Transcript showCR:fileOrNil
|
simple examples:
FileDialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
whenBoxCreatedEvaluate:nil.
|
|fd|
fd := FileDialog new.
fd multipleSelect:true.
fd open
|
|fd|
fd := FileDialog new.
fd multipleSelect:true.
fd browseMenuItemVisible:false.
fd open
|
Adding custom components:
Dialog modifyingBoxWith:[:dialog |
| fmtBox |
fmtBox := ComboListView new.
fmtBox list: #('Comma Separated Values (.csv)'
'Microsoft Excel (.xls)'
'Microsoft Excel XML (.xlsx)') .
fmtBox model:'Select...' asValue.
dialog application addComponent: fmtBox.
] do:[
Dialog requestFileName: 'Save file as...'
]
|
|