View Issue Details

IDProjectCategoryView StatusLast Update
0015677LazarusLCLpublic2010-05-05 08:35
ReporterTomasz WieckowskiAssigned ToPaul Ishenin 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target Version1.0.0Fixed in Version0.9.29 (SVN) 
Summary0015677: Filter in SaveFileDialog
DescriptionThere is a problem with showing the extension in the filename filed of SaveDialog window.
The problem is in the Windows Vista and 7 without "Hide extensions for known file types" options in explorer, on Windows XP this option does not change anything in the filename field (don't add extension from filter).
Additional Information1. On Windows 7, Vista - uncheck "Hide extensions for known file types"
2. Set SaveDialog options
 - SaveDialog1.Filter:='text (*.txt)|*.txt|csv (*.csv)|*csv';
 - SaveDialog1.FileName:='Project';
 - SaveDialog1.Execute;
3. On SaveDialog executed change type to csv and then you will see still "Project.txt"
TagsNo tags attached.
Fixed in Revision
LazTarget1.0
WidgetsetWin32/Win64
Attached Files

Relationships

duplicate of 0007797 closedBart Broersma SaveDialog.Filter does not change the file's extension. 

Activities

Tomasz Wieckowski

2010-02-09 22:04

reporter   ~0034338

I found a very helpful code solves this problem. Maybe you can use this code to fix the problem with Vista and w7. http://www.dotfusion.net/vista-compatible-open-and-save-dialog-in-lazarus-freepascal

samuel herzog

2010-02-13 16:01

developer   ~0034447

looks like aready reported in 2006. see report 0007797.

Paul Ishenin

2010-05-04 03:04

manager   ~0037210

I'm not able to reproduce on windows 7 + unchecked "Hide extensions for known file types".

Please retest and close if it is fixed for you or reopen with more instructions.

Tomasz Wieckowski

2010-05-04 11:06

reporter   ~0037238

I can't test on W7 now, only on Vista and problem still exists.
I simple put this code on button click:
 - SaveDialog1.Filter:='text (*.txt)|*.txt|csv (*.csv)|*csv';
 - SaveDialog1.FileName:='Project';
 - SaveDialog1.Execute;
and explorer is set to display extensions.
I attached screenshots
- withTXT.jpg - what I see when SaveDialog show
- withCSV.jpg - what I see when I change filter to csv, FileName is still with txt (user need manually change extension)

2010-05-04 11:06

 

withTXT.jpg (37,077 bytes)
withTXT.jpg (37,077 bytes)

2010-05-04 11:07

 

withCSV.jpg (37,501 bytes)
withCSV.jpg (37,501 bytes)

Tomasz Wieckowski

2010-05-04 11:22

reporter   ~0037239

tested with rev 24900 (with or without dOldAutoSize).
Box with files works ok, when change to csv, files are filtered to show only csv files. Only filename doesn't want to change.

Paul Ishenin

2010-05-04 11:29

manager   ~0037240

Why Filename should change? Filter is only used to filter the shown files. It has no effect on filename.

So can we close this issue?

Juha Manninen

2010-05-04 11:58

developer   ~0037242

@Paul: the filter actually affected the filename already by adding ".txt" suffix. Logically it should change the suffix when filter changes.

I haven't tested it myself but I would say this is inherent behavior of Windows SaveDialog. The bug report should go to Microsoft.

Tomasz Wieckowski

2010-05-04 12:00

reporter   ~0037244

No Filename but only extension.
I realized that it just not necessary to change the file name extension (what if we would have couple extensions in one filter line).
I suggested this as it work in MSPaint and others but it's probably not a standard feature (but it would be nice if I could change extension on filename).
In Windows XP extension is not displayed in the file name (regardless of whether we have set display extensions in explorer) so there is no problem.
OK we can close this.

Tomasz Wieckowski

2010-05-04 12:24

reporter   ~0037248

BTW If I use SaveDialog code from link in my first post I don't have extension in filename.

Paul Ishenin

2010-05-05 05:18

manager   ~0037271

I see no good way of hiding file extension. Moreover this is standard behavior of windows dialog. In your example it does not change file extension when you choose csv because this file type is not registered. I tried with .pas files and it changes the extension in this case.

Please close if ok.

Issue History

Date Modified Username Field Change
2010-02-04 13:58 Tomasz Wieckowski New Issue
2010-02-04 13:58 Tomasz Wieckowski Widgetset => Win32/Win64
2010-02-09 22:04 Tomasz Wieckowski Note Added: 0034338
2010-02-13 16:01 samuel herzog Note Added: 0034447
2010-02-16 20:41 Vincent Snijders Relationship added duplicate of 0007797
2010-02-16 20:41 Vincent Snijders LazTarget => 1.0
2010-02-16 20:41 Vincent Snijders Status new => acknowledged
2010-02-16 20:41 Vincent Snijders Target Version => 1.0.0
2010-05-04 03:04 Paul Ishenin Status acknowledged => resolved
2010-05-04 03:04 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2010-05-04 03:04 Paul Ishenin Resolution open => unable to reproduce
2010-05-04 03:04 Paul Ishenin Assigned To => Paul Ishenin
2010-05-04 03:04 Paul Ishenin Note Added: 0037210
2010-05-04 11:06 Tomasz Wieckowski Note Added: 0037238
2010-05-04 11:06 Tomasz Wieckowski File Added: withTXT.jpg
2010-05-04 11:07 Tomasz Wieckowski File Added: withCSV.jpg
2010-05-04 11:07 Tomasz Wieckowski Status resolved => assigned
2010-05-04 11:07 Tomasz Wieckowski Resolution unable to reproduce => reopened
2010-05-04 11:22 Tomasz Wieckowski Note Added: 0037239
2010-05-04 11:29 Paul Ishenin Note Added: 0037240
2010-05-04 11:58 Juha Manninen Note Added: 0037242
2010-05-04 12:00 Tomasz Wieckowski Note Added: 0037244
2010-05-04 12:24 Tomasz Wieckowski Note Added: 0037248
2010-05-05 05:18 Paul Ishenin Status assigned => resolved
2010-05-05 05:18 Paul Ishenin Resolution reopened => fixed
2010-05-05 05:18 Paul Ishenin Note Added: 0037271
2010-05-05 08:35 Tomasz Wieckowski Status resolved => closed