requestFileName: on Vista and Windows 7

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

requestFileName: on Vista and Windows 7

Dziedzic, Peter

Hello,

I use the Dialog->requestFileName:....-method.
On Windows Xp it works fine.
But on Vista and Windows 7 the method doesn't add the selected file-extension to the filename.
Did somebody have a samilar problem?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: requestFileName: on Vista and Windows 7

Henrik Sperre Johansen
Den 01.03.2010 11:40, skrev Dziedzic, Peter:

Hello,

I use the Dialog->requestFileName:....-method.
On Windows Xp it works fine.
But on Vista and Windows 7 the method doesn't add the selected file-extension to the filename.
Did somebody have a samilar problem?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

VW does not do this by default. (ie. inserted the selected extension if none was part of the filename selected in the dialog).

I'd check if your image contains overrides of
FileDialog>>requestFileName:default:version: ifFail:for:, and in either case put a halt there to see why the dialog succeds on one platform, but fails on another.

FWIW, I've overridden the return to be
^dialog open
        ifTrue:
            [|selectedPattern|
            selectedPattern := self useWin32NativeDialogs
                        ifTrue: [dialog currentPatterns at: (dialog selectionStruct memberAt: #nFilterIndex)]
                        ifFalse: [dialog fileFilterHolder value].
            dialog selectionString asFilename extension isNil
                & (selectedPattern = '*.*') not
                    ifTrue: [dialog selectionString , selectedPattern asFilename extension]
                    ifFalse: [dialog selectionString]]
        ifFalse: [failBlock value]

which isn't pretty, but works as you seem to expect on both XP and Win7, native and non-native dialogs alike.

Cheers,
Henry



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

requestFileName: on Windows

Dziedzic, Peter
In reply to this post by Dziedzic, Peter

Hello,

I found out that its not only a Windows Vista and Windows 7 problem.
It happens on Windows XP too!

for example this code doesnt work well:

        | dialog |
        dialog := SaveFileDialog new.
        dialog
                addFileFilter: 'Smalltalk source (*.st)' pattern: '*.st';
                addFileFilter: 'Workspace (*.ws)' pattern: '*.ws';
                addFilterForAllFiles;
                fileCondition: #new;
                defaultDirectory: '/tmp';
                defaultFilename: 'example.ws'.
        ^dialog select

When I select Smalltalk source (*.st)' pattern: '*.st' then the filename-extension will be not changed.
Normally in Windows ( e.g. Word ) the filename-extension is same as the selected extension in the drop-down-menu.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





"Dziedzic, Peter" <[hidden email]>
Gesendet von: [hidden email]

01.03.2010 11:40

An
[hidden email]
Kopie
Thema
[vwnc] requestFileName:  on Vista and Windows 7






Hello,


I use the Dialog->requestFileName:....-method.
On Windows Xp it works fine.
But on Vista and Windows 7 the method doesn't add the selected file-extension to the filename.
Did somebody have a samilar problem?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: requestFileName: on Vista and Windows 7

Henrik Sperre Johansen
In reply to this post by Dziedzic, Peter

My apologies, a few more custom messages was assumed...

FileDialogWin32Surrogate>>currentPatterns
     ^fileFilters collect: [:each | each at: 2]

FileDialogWin32Surrogate>>selectionStruct
    ^request ofn
and
CommonDialogsFileNameRequest >> ofn
    ^ofn

Something accomplishing the same in Core, but nicer implemented would be nice indeed.

Cheers,
Henry



Den 01.03.2010 14:41, skrev Henrik Johansen:
Den 01.03.2010 11:40, skrev Dziedzic, Peter:

Hello,

I use the Dialog->requestFileName:....-method.
On Windows Xp it works fine.
But on Vista and Windows 7 the method doesn't add the selected file-extension to the filename.
Did somebody have a samilar problem?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

VW does not do this by default. (ie. inserted the selected extension if none was part of the filename selected in the dialog).

I'd check if your image contains overrides of
FileDialog>>requestFileName:default:version: ifFail:for:, and in either case put a halt there to see why the dialog succeds on one platform, but fails on another.

FWIW, I've overridden the return to be
^dialog open
        ifTrue:
            [|selectedPattern|
            selectedPattern := self useWin32NativeDialogs
                        ifTrue: [dialog currentPatterns at: (dialog selectionStruct memberAt: #nFilterIndex)]
                        ifFalse: [dialog fileFilterHolder value].
            dialog selectionString asFilename extension isNil
                & (selectedPattern = '*.*') not
                    ifTrue: [dialog selectionString , selectedPattern asFilename extension]
                    ifFalse: [dialog selectionString]]
        ifFalse: [failBlock value]

which isn't pretty, but works as you seem to expect on both XP and Win7, native and non-native dialogs alike.

Cheers,
Henry



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: requestFileName: on Vista and Windows 7

Dziedzic, Peter

Hello,

I found out that its not only a Windows Vista and Windows 7 problem.
It happens on Windows XP too!

for example this code doesnt work well too ( This class uses the SaveFileDialog):

        | dialog |
        dialog := SaveFileDialog new.
        dialog
                addFileFilter: 'Smalltalk source (*.st)' pattern: '*.st';
                addFileFilter: 'Workspace (*.ws)' pattern: '*.ws';
                addFilterForAllFiles;
                fileCondition: #new;
                defaultDirectory: '/tmp';
                defaultFilename: 'example.ws'.
        ^dialog select

When I select Smalltalk source (*.st)' pattern: '*.st' then the filename-extension will be not changed.
Normally in Windows ( e.g. Word ) the filename-extension is same as the selected extension in the drop-down-menu.

But i tried the changed requestFileName-Method from Henry. It works fine.
I really wondered that smalltalk dooesnt support this by default.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Henrik Johansen <[hidden email]>
Gesendet von: [hidden email]

01.03.2010 15:43

An
"[hidden email]" <[hidden email]>
Kopie
Thema
Re: [vwnc] requestFileName:  on Vista and Windows 7






My apologies, a few more custom messages was assumed...

FileDialogWin32Surrogate>>currentPatterns
    ^fileFilters collect: [:each | each at: 2]

FileDialogWin32Surrogate>>selectionStruct
   ^request ofn
and
CommonDialogsFileNameRequest >> ofn
   ^ofn

Something accomplishing the same in Core, but nicer implemented would be nice indeed.

Cheers,
Henry



Den 01.03.2010 14:41, skrev Henrik Johansen:

Den 01.03.2010 11:40, skrev Dziedzic, Peter:

Hello,


I use the Dialog->requestFileName:....-method.
On Windows Xp it works fine.
But on Vista and Windows 7 the method doesn't add the selected file-extension to the filename.
Did somebody have a samilar problem?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic


VW does not do this by default. (ie. inserted the selected extension if none was part of the filename selected in the dialog).

I'd check if your image contains overrides of
FileDialog>>requestFileName:default:version: ifFail:for:, and in either case put a halt there to see why the dialog succeds on one platform, but fails on another.

FWIW, I've overridden the return to be
^dialog open
       ifTrue:
           [|selectedPattern|
           selectedPattern := self useWin32NativeDialogs
                       ifTrue: [dialog currentPatterns at: (dialog selectionStruct memberAt: #nFilterIndex)]
                       ifFalse: [dialog fileFilterHolder value].
           dialog selectionString asFilename extension isNil
               & (selectedPattern = '*.*') not
                   ifTrue: [dialog selectionString , selectedPattern asFilename extension]
                   ifFalse: [dialog selectionString]]
       ifFalse: [failBlock value]

which isn't pretty, but works as you seem to expect on both XP and Win7, native and non-native dialogs alike.

Cheers,
Henry

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



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


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