When I first replied I didn't realize you also wanted to stop user
over-ride...which may or may not be a good idea.  But I've done something
like this in the past where I test to ensure only the filetype set in the
filters is chosen:

If Openfiledlg.Execute then
Begin
       If uppercase(JustExtensionL(OpenFiledlg.Filename)) <> 'TXT' then
       Begin
              ShowMessage('Only Text Files may be opened!');
               Abort;
       End
       Else
       Begin
              Memo.loadFromfile(OpenFiledlg.Filename); 
       End;
End;  

from Robert Meek dba Tangentals Design  CCopyright 2006
Proud to be a moderator of "The Delphi Lists" at elists.org

"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
                                                    Albert Einstein


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Eddie Shipman
Sent: Saturday, August 05, 2006 10:30 AM
To: Borland's Delphi Discussion List
Subject: RE: How to limit user to "filter" file extensions

Best bet is to write your own FileOpenDialog and filter the files when the 
FileName of *.* is selected. The standard Opendialog is a wrapper for the 
Windows Common Control and cannot be extended to do this because there are
no notifcation messages sent when the user enters anything in the FileName
edit area.

> Wayne,
> If they type (e.g.) *.* in the file name box, they get to see all files
> and can then select anything.
> I need to support a few (completely different) file types which are
> processed in different ways, but I do not want to allow the user to pick
> some rubbish instead.
> Ken


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to