eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FileDialog':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: FileDialog


Inheritance:

   Object
   |
   +--Model
      |
      +--ApplicationModel
         |
         +--SimpleDialog
            |
            +--FileDialog
               |
               +--FileDialogWithPreview

Package:
stx:libtool
Category:
Interface-Tools-File
Version:
rev: 1.151 date: 2018/04/16 03:57:26
user: cg
file: FileDialog.st directory: libtool
module: stx stc-classLibrary: libtool
Author:
Martin Walser (martin@vercingetorix)

Description:


A slightly better file dialog


[instance variables:]

[class variables:]


Related information:



Class protocol:

accessing
o  classResources

o  lastExtent

o  lastExtent: anExtent

o  setDoubleClickActionFor: instance

help specs
o  helpSpec
This resource specification was automatically generated
by the UIHelpTool of ST/X.

instance creation
o  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'

o  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'

o  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'

o  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

o  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'

o  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.

o  requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil whenBoxCreatedEvaluate: boxCreatedCallback

o  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

o  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

o  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.

o  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

o  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.

o  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.

o  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
o  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
o  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

o  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

o  viewInContentsBrowserMenu

plugIn spec
o  aspectSelectors
This resource specification was automatically generated
by the UIPainter of ST/X.


Instance protocol:

accessing
o  currentSelectedFiles

o  defaultWindowExtent
return my default window extent or nil.
Return nil if the defaul extent should be computed by other means.

o  directory
return the value of the instance variable 'directory' (automatically generated)

o  directory: something
set the value of the instance variable 'directory' (automatically generated)

o  initialText

o  initialText: something

o  pattern
return the value of the instance variable 'pattern' (automatically generated)

o  pattern: something
set the value of the instance variable 'pattern' (automatically generated)

o  result
return the value of the instance variable 'result' (automatically generated)

o  result: something
set the value of the instance variable 'result' (automatically generated)

o  selectedDirectories

o  startFilename

o  startFilename: something

accessing-behavior
o  asLoadDialog

o  asLoadDialog: aBoolean

o  beLoadDialog: aBoolean

o  doubleClickAction
return the value of the instance variable 'doubleClickAction' (automatically generated)

o  doubleClickAction: something
set the value of the instance variable 'doubleClickAction' (automatically generated)

o  isLoadDialog

o  multipleSelect

o  multipleSelect: aBoolean

accessing-components
o  addButton: aButton

o  okButton

o  treeBrowser
return the value of the instance variable 'treeBrowser' (automatically generated)

accessing-look
o  hideButtonPanel

o  newDirectoryVisibilityHolder

o  showButtonPanel

o  viewFiles
return the value of the instance variable 'viewFiles' (automatically generated)

o  viewFiles: something
set the value of the instance variable 'viewFiles' (automatically generated)

aspects
o  appendButtonVisibleHolder
if set, an additional 'append' button is shown
(to let user append to a file, instead of overwriting the file)

o  appendLabelHolder

o  aspectOrNil: aKey forSubApplication: aSubApp
this hook provides an aspect for a subApp

o  browseMenuItemVisible: aBoolean
controls if an 'open filebrowser' menu item is to be shown in the toolbar

o  browseMenuItemVisibleHolder
controls if an 'open filebrowser' menu item is to be shown in the toolbar

o  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) **

o  buttonPanelVisibleHolder

o  cancelLabelHolder

o  enableBack

o  enableDirectoryUp

o  enableForward

o  enableGotoDesktop

o  enableHome

o  fileEntryFieldHolder
for directoryTreeBrowser

o  filenameHolder
Return a value holder with the filename.
Shown in the filename input-field.
Being the selection in the tree.

o  filenameHolder: aHolder
needed when used as subcanvas

o  filenameLabelHolder
Return a value holder for the input string.

o  filterHolder
Return a value holder for filter

o  filterHolder: aHolder
needed when used as subcanvas

o  gotoBookmarksMenu
|menu bookmarks|

o  listOfDeviceDrives

o  okLabelEnabled

o  okLabelHolder

o  rootDirectoryHolder
Return a value holder for filter

o  rootDirectoryHolder: aHolder
Return a value holder for filter

o  selectedDeviceDrive

o  showDirectoryTree

o  showDiskUsageHolder

o  showHiddenFiles

o  shownFiles

o  sortCaselessInTreeBrowser

o  sortInTreeVisibilityHolder

o  sortPropertyInTree

o  viewDirsInContentsBrowser

o  viewFilesInDirectoryTree

o  viewNoteBookApplicationHolder

change & update
o  buttonPanelVisibilityChanged
force resize

o  fileSelectionChanged

o  selectedDeviceDriveChanged
Filename defaultVolumeName.

o  update: something with: aParameter from: changedObject
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:

construction-adding
o  addComponent: aView

event handling
o  appendWasPressed
valid after the dialog has been closed: true if append was pressed

initialization & release
o  closeDownViews
(comment from inherited method)
close down the application's view(s)

o  closeWindow
(comment from inherited method)
close the dialog

o  commonPostOpen
self windowGroup addPreEventHook:self.

o  initialRootDirectory
returns the directory the browser is open on

o  initialize

o  postBuildFileNameField: aWidget

o  postBuildFilterField: aWidget

o  postBuildTreeBrowser: aSubCanvasView

o  postBuildVerticalPanelView: aView

o  postBuildWith: aBuilder
minExtent is nil if window is not a TopView

o  postOpenAsSubcanvasWith: aBuilder
No ok and cancel buttons, when dialog is part of a larger dialog

o  preOpenWith: aBuilder
called right before being opened

o  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
o  bookmarksMenu

o  directoryMenu

o  showMenuSpecForDialog

o  sortMenu

o  visitedDirectoriesMenu

private
o  returnWasPressedInFilterField
ev targetView isSameOrComponentOf:filenameField

o  returnWasPressedInFilterOrFilenameField
ev targetView isSameOrComponentOf:filenameField

queries
o  driveSelectorVisible

user actions
o  appendPressed

o  commonAcceptAction

o  doAccept
force accept - ignore in filterField

o  doBack

o  doBrowseDirectory

o  doCancel

o  doForward

o  doGoDirectoryUp

o  doGotoDesktopDirectory

o  doGotoDocumentsDirectory

o  doGotoDownloadsDirectory

o  doGotoHomeDirectory

o  menuDirHistory: backOrForward

o  menuDirHistoryBack

o  menuDirHistoryForward

o  newDirectory
forward to the treebrowser component, which already has this functionality

o  okPressed

o  updateCurrentDirectory


Examples:


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...'
  ]


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sat, 23 Mar 2019 08:52:22 GMT