|
Class: FileDialog
Object
|
+--Model
|
+--ApplicationModel
|
+--SimpleDialog
|
+--FileDialog
|
+--FileDialogWithPreview
- Package:
- stx:libtool
- Category:
- Interface-Tools-File
- Version:
- rev:
1.157
date: 2019/05/02 19:26:47
- user: cg
- file: FileDialog.st directory: libtool
- module: stx stc-classLibrary: libtool
- Author:
- Martin Walser (martin@vercingetorix)
A slightly better file dialog
[instance variables:]
[class variables:]
accessing
-
classResources
-
-
lastExtent
-
-
lastExtent: anExtent
-
-
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: pattern 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: pattern 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: pattern 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: pattern fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: asLoadDialog viewFiles: viewFiles multipleSelect: multipleSelect
-
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
-
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.
accessing
-
appendWasPressed
-
valid after the dialog has been closed: true if append was pressed
-
currentSelectedFiles
-
-
defaultWindowExtent
-
return my default window extent or nil.
Return nil if the defaul extent should be computed by other means.
-
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: something
-
set the value of the instance variable 'pattern' (automatically generated)
-
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
-
-
asLoadDialog: aBoolean
-
-
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)
accessing-look
-
hideButtonPanel
-
-
newDirectoryVisibilityHolder
-
-
showButtonPanel
-
-
viewFiles
-
return the value of the instance variable 'viewFiles' (automatically generated)
-
viewFiles: something
-
set the value of the instance variable 'viewFiles' (automatically generated)
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
-
browseVisibleHolder
-
controls if an 'open filebrowser' menu item is to be shown in the toolbar
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
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
-
-
okLabelEnabled
-
-
okLabelHolder
-
-
rootDirectoryHolder
-
Return a value holder for filter
-
rootDirectoryHolder: aHolder
-
Return a value holder for filter
-
selectedDeviceDrive
-
-
showDirectoryTree
-
-
showDiskUsageHolder
-
-
showHiddenFiles
-
-
shownFiles
-
-
sortCaselessInTreeBrowser
-
-
sortInTreeVisibilityHolder
-
-
sortPropertyInTree
-
-
viewDirsInContentsBrowser
-
-
viewFilesInDirectoryTree
-
-
viewNoteBookApplicationHolder
-
change & update
-
buttonPanelVisibilityChanged
-
force resize
-
fileSelectionChanged
-
-
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
-
closeDownViews
-
(comment from inherited method)
close down the application's view(s)
-
closeWindow
-
(comment from inherited method)
close the dialog
-
commonPostOpen
-
self windowGroup addPreEventHook:self.
-
initialRootDirectory
-
returns the directory the browser is open on
-
initialize
-
-
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
-
if the user changed the size of the dialog, the next time the dialog
is opened with this size.
But ignore height changes < 40 pixels. On some systems the height of the title bar
is added to the height. (https://expeccoalm.exept.de/D160693)
menus
-
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
-
-
doFindAndSelectFile
-
search the next file matching a requested pattern
-
doFindAndSelectNextFile
-
search the next file matching the previous pattern
-
doForward
-
-
doGoDirectoryUp
-
-
doGotoDesktopDirectory
-
-
doGotoDocumentsDirectory
-
-
doGotoDownloadsDirectory
-
-
doGotoHomeDirectory
-
-
menuDirHistory: backOrForward
-
-
menuDirHistoryBack
-
-
menuDirHistoryForward
-
-
newDirectory
-
forward to the treebrowser component, which already has this functionality
-
okPressed
-
-
updateCurrentDirectory
-
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...'
]
|
|