Board index » cppbuilder » TSaveDialog and case sensitivity on registered file extensions

TSaveDialog and case sensitivity on registered file extensions


2004-02-24 04:26:38 AM
cppbuilder59
Using BCB v6 sp4 on Win2k.
With TSaveDialog if I set a DefaultExt and type in a file name that includes an
extension then if the extension is one of the registered extensions (if it is one of
the file extensions assigned to the Filter property of TSaveDialog) then the returned
file name is what I would expect.
But there is one situation where the actual behavior is unexpected: If the user types
in the file extension with a different case then the DefaultExt gets appended to it.
Suppose prj and pxx are extensions on the list and the default extension is pxx. If
the user enters the file name:
myfile.prj
then I get
myfile.prj
returned from the FileName property.
But if the user enters:
myfile.PRJ
then I get
myfile.PRJ.pxx
returned from the FileName property.
Is there any way to make this behavior non-case sensitive?
 
 

Re:TSaveDialog and case sensitivity on registered file extensions

"Randall Parker" < XXXX@XXXXX.COM >wrote
in message news:403a6191$ XXXX@XXXXX.COM ...
Quote
But if the user enters:
myfile.PRJ
then I get
myfile.PRJ.pxx
returned from the FileName property.
I want to offer a Damon Chandler suggestion for a similar problem.
Altering his message, you need to do the testing in OnCanClose of the
Save Dialog, and check for a badly typed Extension. The problem is
that OnCanClose happens before the dialog has added the
filter-extension. This is too much coding, it's fair to say. But it
has the advantage of fitting well into the VCL. It may be possible to
look at the filename after the dialog has added the filter extension,
but it will require fighting with the VCL for control of the API's
dialog.
www.mers.com/MERLIST/BORLAND/PUBLIC/CPPBUILDER/VCL/COMPONENTS/U
SING/27133.HTML
(long link warning-repaste as one line, ending in "L".)
Post again if you hate this solution.