Hi all,
my coleagues asked me to do some extensions to FileDialog so I digged in. And found a thing I consider to be a bug. If you do "FileDialog saveFileExample" you can see "example.ws" written down there in file name edit field. Now if you change directory or filter (type), the "example.ws" disappear. The reason is that every time dataset selection is changed, the filename input field (or the value model under it) is updated. This behaviour is allright in OpenFileDialog or ChooseDirectoryDialog. But it's not right in SaveFileDialog where the file name should be kept as long as possible (until another file is selected). Patch is attached. Regards, Milan Cermak PS: Vasilli, my implementation behaved right. Did you removed that on purpose? -- Ing. Milan Čermák programátor, analytik [hidden email] ................................................................ e-FRACTAL, s.r.o. => e-business driven company nám. Míru 15, Praha 2, http://www.e-fractal.cz tel: 222 512 000, fax: 222 515 000 ................................................................ <?xml version="1.0"?> <st-source> <time-stamp>From VisualWorks®, 7.4 of 5. prosinec 2005 on 29. Äerven 2006 at 15:12:20</time-stamp> <methods> <class-id>Tools.SaveFileDialog class</class-id> <category>interface specs</category> <body package="_runtime_additions_" selector="windowSpec">windowSpec "Tools.UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication true ) #label: #windowTitle #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 0 0 ) #bounds: #(#{Graphics.Rectangle} 720 450 1220 810 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.InputFieldSpec} #layout: #(#{Graphics.LayoutFrame} 95 0 -95 1 -10 1 -70 1 ) #name: #Filename #model: #filenameHolder ) #(#{UI.MenuButtonSpec} #layout: #(#{Graphics.LayoutFrame} 95 0 -65 1 -10 1 -40 1 ) #name: #FileTypes #model: #fileFilterHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #updateFileList ) #menu: #fileFiltersMenuHolder ) #(#{UI.ActionButtonSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication true ) #layout: #(#{Graphics.LayoutFrame} -180 1 -35 1 -100 1 -10 1 ) #name: #Accept #flags: 40 #model: #acceptButtonPressed #label: #acceptButtonLabel #isDefault: true #defaultable: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.LayoutFrame} -90 1 -35 1 -10 1 -10 1 ) #name: #Cancel #model: #cancel #label: #(#{Kernel.UserMessage} #key: #Cancel #defaultString: 'Cancel' #catalogID: #dialogs ) #defaultable: true ) #(#{UI.MenuButtonSpec} #layout: #(#{Graphics.LayoutFrame} 65 0 10 0 -125 1 35 0 ) #name: #Directory #model: #directoryHolder #menu: #directoryMenuHolder ) #(#{UI.DataSetSpec} #properties: #(#{UI.PropertyListDictionary} #showHorizontalLines false #allowColumnResizing false #rowSize 18 #showVerticalLines false #allowColumnReordering false ) #layout: #(#{Graphics.LayoutFrame} 10 0 40 0 -10 1 -100 1 ) #name: #FileList #flags: 13 #model: #fileListHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #listItemSelected #doubleClickSelector: #goDownOrAccept ) #columns: #( #(#{UI.DataSetColumnSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication false #allowSorting true #allowResizing false ) #model: #fileSelectionTailHolder #label: 'Name' #labelIsImage: false #width: 80 #rendererType: #Arbitrary #editorType: #Arbitrary #alignment: #left #noScroll: false ) #(#{UI.DataSetColumnSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication false #allowSorting true #allowResizing false ) #model: #'fileSelectionHolder fileSize' #label: 'Size' #labelIsImage: false #width: 80 #rendererType: #Text #editorType: #None #alignment: #right #type: #number #noScroll: false ) #(#{UI.DataSetColumnSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication false #allowSorting true #allowResizing false ) #model: #'fileSelectionHolder modificationTimestamp' #label: 'Last Modified' #labelIsImage: false #width: 80 #rendererType: #Text #editorType: #None #type: #timestamp #noScroll: false ) ) #labelsAsButtons: true ) #(#{UI.ActionButtonSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication true ) #layout: #(#{Graphics.LayoutFrame} -120 1 10 0 -95 1 35 0 ) #name: #GoUpDirectory #model: #goUpDirectory #helpText: #(#{Kernel.UserMessage} #key: #TooltipGoToParentDirectory #defaultString: 'Go to parent directory' #catalogID: #dialogs ) #label: #upDirectoryImage #hasCharacterOrientedLabel: false #defaultable: true ) #(#{UI.ActionButtonSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication true ) #layout: #(#{Graphics.LayoutFrame} -90 1 10 0 -65 1 35 0 ) #name: #CreateDir #model: #createDirectory #helpText: #(#{Kernel.UserMessage} #key: #TooltipCreateNewDirectory #defaultString: 'Create a new directory' #catalogID: #dialogs ) #label: #createDirectoryImage #hasCharacterOrientedLabel: false #defaultable: true ) #(#{UI.ActionButtonSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication true ) #layout: #(#{Graphics.LayoutFrame} -60 1 10 0 -35 1 35 0 ) #name: #GoToHomeDirectory #model: #goToHomeDirectory #helpText: #(#{Kernel.UserMessage} #key: #TooltipGoToHomeDirectory #defaultString: 'Go to user home directory' #catalogID: #dialogs ) #label: #homeImage #hasCharacterOrientedLabel: false #defaultable: true ) #(#{UI.ActionButtonSpec} #properties: #(#{UI.PropertyListDictionary} #labelFromApplication true ) #layout: #(#{Graphics.LayoutFrame} -35 1 10 0 -10 1 35 0 ) #name: #GoToCurrentDirectory #model: #goToCurrentDirectory #helpText: #(#{Kernel.UserMessage} #key: #TooltipGoToDefaultDirectory #defaultString: 'Go to default directory' #catalogID: #dialogs ) #label: #currentDirectoryImage #hasCharacterOrientedLabel: false #defaultable: true ) #(#{UI.CheckBoxSpec} #layout: #(#{UI.AlignmentOrigin} 10 0 -10 1 0 1 ) #name: #ShowHidden #model: #showHiddenHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #updateFileList ) #label: 'Show hidden files and directories' ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 10 0 35 0 0 1 ) #name: #LookInLabel #label: #(#{Kernel.UserMessage} #key: #LookInC #defaultString: 'Look in:' #catalogID: #dialogs ) ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 10 0 -70 1 0 1 ) #name: #FilenameLabel #label: #(#{Kernel.UserMessage} #key: #FileNameC #defaultString: 'File name:' #catalogID: #dialogs ) ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 10 0 -40 1 0 1 ) #name: #FilesOfTypeLabel #label: #(#{Kernel.UserMessage} #key: #FilesOfTypeC #defaultString: 'Files of type:' #catalogID: #dialogs ) ) ) ) )</body> </methods> <methods> <class-id>Tools.SaveFileDialog</class-id> <category>updating</category> <body package="_runtime_additions_" selector="fileSelected">fileSelected | selection | selection := self fileSelectionHolder value. (selection notNil and: [selection isDirectory not]) ifTrue: [ self filenameHolder value: selection tail ].</body> </methods> <methods> <class-id>Tools.SaveFileDialog</class-id> <category>actions</category> <body package="_runtime_additions_" selector="goDownOrAccept">goDownOrAccept | filename | filename := self fileSelectionHolder value. (self isDirectory: filename) ifTrue: [self directoryHolder value: filename] ifFalse: [self doAccept].</body> </methods> <methods> <class-id>Tools.SaveFileDialog</class-id> <category>updating</category> <body package="_runtime_additions_" selector="updateFileExtension">updateFileExtension | name filter | name := self filenameHolder value. name isEmpty ifTrue: [^self]. filter := self fileFilterHolder value asArrayOfSubstringsBy: $;. (filter anySatisfy: [:mask | mask match: name]) ifFalse: [ | filename index extension | index := filter first lastIndexOf: $.. extension := filter first copyFrom: index. filename := name asFilename constructWithExtension: extension. self filenameHolder value: filename asString. ]</body> </methods> <methods> <class-id>Tools.SaveFileDialog</class-id> <category>updating</category> <body package="_runtime_additions_" selector="updateFileList">updateFileList super updateFileList. self updateFileExtension</body> </methods> </st-source> |
Free forum by Nabble | Edit this page |