Autor Beitrag
hansg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 168

Win XP Professional SP3, Vista Ultimate 32 SP1
Delphi 6 Professional
BeitragVerfasst: Sa 17.11.07 15:05 
Hallo zusammen,

gibt es die Möglichkeit das ein OpenDialog nur einen bestimmten Filter akzeptiert (*.log ) und keine anderen,
auch wenn man bei Dateiname was anderes z.B. *.* eingibt?
Habe schon in der Hilfe nachgesehen bzw. nichts über die Suche gefunden.
Das war meine Idee, hat aber nichts gebracht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.OpenDialog1TypeChange(Sender: TObject);
begin
  if opendialog1.Filter<>'*.log' then opendialog1.Filter:='*.log';
end;

_________________
Gruß Hans
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 17.11.07 15:47 
Soweit ich weiß geht das nicht. Du kannst aber nach dem OpenDialog.Execute überprüfen, ob eine "gültige" Datei markiert wurde und ggf. den Dialog direkt nochmal anzeigen lassen.

_________________
We are, we were and will not be.
gispos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 94

WIN 7
XE10, D2007
BeitragVerfasst: So 18.11.07 22:29 
Du kannst noch unter Option "FileMustExist" auf true setzen, dann muß zumindest die Datei vorhanden sein.
Danach einfach Dateiname prüfen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
If OpenDialog.Execute and SameText(ExtractFileExt(OpenDialog.FileName), '.log'then
begin
  // ???
end;

Gruß gispos