DialogBox.st
changeset 2355 986d96f5ff6c
parent 2332 913a3743b9b4
child 2360 aaa46220ccd6
equal deleted inserted replaced
2354:373ee1f525e3 2355:986d96f5ff6c
  1736      last fileBox directory (default: current directory) (if a nil path is given).
  1736      last fileBox directory (default: current directory) (if a nil path is given).
  1737      The box will show okText in its okButton, abortText in the abortButton.
  1737      The box will show okText in its okButton, abortText in the abortButton.
  1738      The matchPattern is set to pattern initially.
  1738      The matchPattern is set to pattern initially.
  1739      Return the string, or nil if cancel was pressed."
  1739      Return the string, or nil if cancel was pressed."
  1740 
  1740 
       
  1741     ^ self
       
  1742         requestFileName:titleString 
       
  1743         default:defaultName 
       
  1744         ok:okText 
       
  1745         abort:abortText 
       
  1746         pattern:pattern 
       
  1747         fromDirectory:aDirectoryPathOrNil 
       
  1748         whenBoxCreatedEvaluate:nil
       
  1749 !
       
  1750 
       
  1751 requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback
       
  1752     "launch a Dialog, which allows user to enter a filename.
       
  1753      The files presented initially are those in aDirectoryPathOrNil, or the
       
  1754      last fileBox directory (default: current directory) (if a nil path is given).
       
  1755      The box will show okText in its okButton, abortText in the abortButton.
       
  1756      The matchPattern is set to pattern initially.
       
  1757      Return the string, or nil if cancel was pressed."
       
  1758 
  1741     |box defaultDir defaultNm dir enteredName|
  1759     |box defaultDir defaultNm dir enteredName|
  1742 
  1760 
  1743     defaultNm := defaultName.
  1761     defaultNm := defaultName.
  1744     defaultDir := aDirectoryPathOrNil.
  1762     defaultDir := aDirectoryPathOrNil.
  1745     defaultDir isNil ifTrue:[
  1763     defaultDir isNil ifTrue:[
  1768             box directory:dir.
  1786             box directory:dir.
  1769         ].
  1787         ].
  1770     ].
  1788     ].
  1771     box pattern:pattern.
  1789     box pattern:pattern.
  1772     box initialText:defaultNm.
  1790     box initialText:defaultNm.
       
  1791     boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:box].
  1773     box showAtPointer.
  1792     box showAtPointer.
  1774     box action:nil.
  1793     box action:nil.
  1775     box destroy.
  1794     box destroy.
  1776 
  1795 
  1777     (enteredName notNil 
  1796     (enteredName notNil 
  1948     "Modified: 20.2.1997 / 18:12:28 / cg"
  1967     "Modified: 20.2.1997 / 18:12:28 / cg"
  1949     "Modified: 21.2.1997 / 14:27:27 / stefan"
  1968     "Modified: 21.2.1997 / 14:27:27 / stefan"
  1950 !
  1969 !
  1951 
  1970 
  1952 requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath
  1971 requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath
       
  1972     "launch a Dialog, which allows user to enter a filename.
       
  1973      Return the string or the value of failBlock if cancel was pressed.
       
  1974      The version argument allows validation of the files existance;
       
  1975      it may be any of:
       
  1976         #mustBeNew      - fail (return empty string) if the file exists
       
  1977         #new            - confirm if the file exists
       
  1978         #mustBeOld      - fail if the file does not exist
       
  1979         #old            - confirm if the file does not exist
       
  1980         #any (other)    - no validation
       
  1981     "
       
  1982 
       
  1983     ^ self
       
  1984         requestFileName:titleString 
       
  1985         default:defaultName 
       
  1986         version:versionSymbol 
       
  1987         ifFail:failBlock 
       
  1988         pattern:pattern 
       
  1989         fromDirectory:aDirectoryPath 
       
  1990         whenBoxCreatedEvaluate:nil
       
  1991 !
       
  1992 
       
  1993 requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback
  1953     "launch a Dialog, which allows user to enter a filename.
  1994     "launch a Dialog, which allows user to enter a filename.
  1954      Return the string or the value of failBlock if cancel was pressed.
  1995      Return the string or the value of failBlock if cancel was pressed.
  1955      The version argument allows validation of the files existance;
  1996      The version argument allows validation of the files existance;
  1956      it may be any of:
  1997      it may be any of:
  1957         #mustBeNew      - fail (return empty string) if the file exists
  1998         #mustBeNew      - fail (return empty string) if the file exists
  2005         ].
  2046         ].
  2006         FileSelectionBox lastFileSelectionDirectory:box directory.
  2047         FileSelectionBox lastFileSelectionDirectory:box directory.
  2007         box destroy. 
  2048         box destroy. 
  2008         ^ name
  2049         ^ name
  2009     ].
  2050     ].
       
  2051     boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:box].
  2010     box showAtPointer.
  2052     box showAtPointer.
  2011     box action:nil.
  2053     box action:nil.
  2012     box destroy. 
  2054     box destroy. 
  2013     ^ failBlock value
  2055     ^ failBlock value
  2014 
  2056 
  6703 ! !
  6745 ! !
  6704 
  6746 
  6705 !DialogBox class methodsFor:'documentation'!
  6747 !DialogBox class methodsFor:'documentation'!
  6706 
  6748 
  6707 version
  6749 version
  6708     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.161 2000-12-21 13:07:28 cg Exp $'
  6750     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.162 2001-04-23 08:21:56 cg Exp $'
  6709 ! !
  6751 ! !
  6710 DialogBox initialize!
  6752 DialogBox initialize!