class: FileDialog
class definition
added: #okLabelEnabled
changed:
#startApplicationFor:default:ok:abort:ifFail:pattern:fromDirectory:whenBoxCreatedEvaluate:asLoadDialog:viewFiles:multipleSelect:
#windowSpec
When requesting a file for load, show OK-Button only if a valif file is selected.
--- a/FileDialog.st Mon Jul 27 19:49:48 2015 +0200
+++ b/FileDialog.st Wed Jul 29 19:17:42 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2002 by eXept Software AG
All Rights Reserved
@@ -21,7 +23,7 @@
appendButtonVisibleHolder appendWasPressed
buttonPanelVisibleHolder appendLabelHolder browseVisibleHolder
selectedDeviceDrive listOfDeviceDrives rootDirectoryHolder
- initialRoot verticalPanelView'
+ initialRoot verticalPanelView okLabelEnabled'
classVariableNames:'LastExtent'
poolDictionaries:''
category:'Interface-Tools-File'
@@ -692,15 +694,17 @@
instance := self new.
defaultDir notNil ifTrue:[instance directory:defaultDir].
- instance multipleSelect:multipleSelect ? false.
- instance startFilename:defaultFile.
- instance pattern:((pattern isEmptyOrNil) ifTrue:['*'] ifFalse:[pattern]).
- instance initialText:titleString.
- instance okLabelHolder value:okText.
- instance cancelLabelHolder value:abortText.
+ instance
+ multipleSelect:multipleSelect ? false;
+ startFilename:defaultFile;
+ pattern:(pattern isEmptyOrNil ifTrue:['*'] ifFalse:[pattern]);
+ initialText:titleString;
+ beLoadDialog:asLoadDialog ? false;
+ viewFiles:viewFiles ? true.
- instance beLoadDialog:asLoadDialog ? false.
- instance viewFiles:viewFiles ? true.
+ instance okLabelHolder value:okText.
+ instance cancelLabelHolder value:abortText.
+
self setDoubleClickActionFor:instance.
instance allButOpenInterface:#windowSpec.
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance].
@@ -952,7 +956,7 @@
labelChannel: cancelLabelHolder
tabable: true
model: doCancel
- extent: (Point 128 28)
+ extent: (Point 129 20)
usePreferredHeight: true
)
(ActionButtonSpec
@@ -963,7 +967,7 @@
labelChannel: appendLabelHolder
tabable: true
model: appendPressed
- extent: (Point 128 28)
+ extent: (Point 129 20)
usePreferredHeight: true
)
(ActionButtonSpec
@@ -973,8 +977,9 @@
labelChannel: okLabelHolder
tabable: true
model: okPressed
+ enableChannel: okLabelEnabled
isDefault: true
- extent: (Point 128 28)
+ extent: (Point 130 20)
usePreferredHeight: true
)
)
@@ -1585,6 +1590,26 @@
^ listOfDeviceDrives
!
+okLabelEnabled
+ <resource: #uiAspect>
+
+ okLabelEnabled isNil ifTrue:[
+ isLoadDialog ifTrue:[
+ okLabelEnabled := BlockValue
+ with:[:filename| filename notNil
+ and:[viewFiles
+ ifTrue:[filename asFilename physicalFilename isRegularFile]
+ ifFalse:[filename asFilename physicalFilename isDirectory]
+ ]
+ ]
+ argument:self filenameHolder.
+ ] ifFalse:[
+ okLabelEnabled := true.
+ ].
+ ].
+ ^ okLabelEnabled.
+!
+
okLabelHolder
"automatically generated by UIPainter ..."