[vwnc] OpenFileDialog, default filter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] OpenFileDialog, default filter

Steffen Märcker
Hi,

I've noticed, that the order of file filters on windows is not consitent  
with the other platforms / native dialogs. The filters appear in reverse  
order.
Additionally the native dialog always sets the filter on opening to "all  
files" if this filter appears somewhere in the filter list. The lines of  
code below fixes that.

Steffen


FileDialog>>rebuildFileFiltersMenu
       
        | descriptions filters |
        fileFilters isEmpty ifTrue: [self addFilterForAllFiles].
        descriptions := OrderedCollection new: fileFilters size.
        filters := OrderedCollection new: fileFilters size.
        fileFilters
                do:
                        [:labelAndPatterns |
                        descriptions add: labelAndPatterns first.
                        filters add: (labelAndPatterns at: 2)].
        self fileFiltersMenuHolder
                value: (Menu labelArray: descriptions values: filters).
        "use the first filter by default except another one is alread set"
        self filenameEntry = ''
                ifTrue: [fileFilterHolder value: (fileFilters first at: 2)]

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc