Why don't the open and save dialogs show files matching the selected filter?

1.3k views Asked by At

I want my open and save dialogs to display XML files. I have this definition:

// The save dialog
dlg := TSaveDialog.Create(nil);
dlg.Options := [ofOverwritePrompt];
dlg.Title := 'Seleccione la ubicaciĆ³n del archivo';
dlg.Filter := 'Xml | *.xml | Todo | *.*';
dlg.DefaultExt := 'xml';
dlg.Execute();
// The open dialog
dlg := TOpenDialog.Create(self);
dlg.Title := 'Seleccione la ubicaciĆ³n del archivo';
dlg.Filter := 'Xml | *.xml | Todo | *.*';
dlg.DefaultExt := 'xml';
dlg.Execute();

But it doesn't show XML files. To show any XML files in a path, I need to choose the "Todo" (*.*) filter. Why doesn't it show files when the XML filter is selected?

1

There are 1 answers

0
Sertac Akyuz On BEST ANSWER

Remove the spaces around the extension. The dialog is trying to filter "*.xml " files, but there's none. Refer to the documentation for examples.