Примерчик
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
SaveDialog1: TSaveDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure SaveDialog1Show(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveDialog1.Filter := 'Text File (*.txt)|*.txt|CSS File (*.css)|*.css';
SaveDialog1.FileName := 'temp.css';
if ExtractFileExt(SaveDialog1.FileName) = '.txt' then
SaveDialog1.FilterIndex := 1;
if ExtractFileExt(SaveDialog1.FileName) = '.css' then
SaveDialog1.FilterIndex := 2;
SaveDialog1.Execute;
end;
procedure TForm1.SaveDialog1Show(Sender: TObject);
begin
end;
end.
-------------------------------------------------------
if ExtractFileExt(SaveDialog1.FileName) = '.txt' then
SaveDialog1.FilterIndex := 1;
if ExtractFileExt(SaveDialog1.FileName) = '.css' then
SaveDialog1.FilterIndex := 2;
Как это сделать с OnShow?