unit mOpenOptions;
interface
uses
Messages, Windows, SysUtils, Classes, Controls, StdCtrls, Graphics,
ExtCtrls, Buttons, Dialogs, ExtDlgs, ComCtrls;
type
TOptionsClick =
procedure(Sender: TObject)
of object;
TOpenOptionsDialog =
class(TOpenDialog)
private
FExtraPanel: TPanel;
FOptionsClick: TOptionsClick;
FOptionen: TButton;
{ Private-Deklarationen }
protected
procedure DoClose;
override;
procedure DoShow;
override;
{ Protected-Deklarationen }
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
function Execute: Boolean;
override;
{ Public-Deklarationen }
published
property OnOptionsClick: TOptionsClick
read FOptionsClick
write FOptionsClick;
{ Published-Deklarationen }
end;
type
TSaveOptionsDialog =
class(TOpenOptionsDialog)
private
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
function Execute: Boolean;
override;
{ Public-Deklarationen }
published
{ Published-Deklarationen }
end;
procedure Register;
implementation
{$R *.res}
uses
Consts, Forms, CommDlg, Dlgs;
constructor TOpenOptionsDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FExtraPanel := TPanel.Create(Self);
FExtraPanel.
Name := '
ExtraPanel';
FExtraPanel.Caption := '
';
FExtraPanel.BevelOuter := bvNone;
FExtraPanel.BorderWidth := 2;
FExtraPanel.TabOrder := 1;
FOptionen := TButton.Create(Self);
FOptionen.
Name := '
BtOptionen';
FOptionen.Caption := '
Optionen...';
FOptionen.Parent := FExtraPanel;
FOptionen.SetBounds(195, 0, 75, 24);
end;
destructor TOpenOptionsDialog.Destroy;
begin
FOptionen.Free;
FExtraPanel.Free;
inherited Destroy;
end;
procedure TOpenOptionsDialog.DoClose;
begin
inherited DoClose;
Application.HideHint;
// Hide any hint windows left behind
end;
procedure TOpenOptionsDialog.DoShow;
var SepRect, StaticRect: TRect;
begin
StaticRect := GetStaticRect;
// Set ExtraText area to bottom of static area
SepRect.Top := StaticRect.Bottom;
SepRect.Bottom := SepRect.Top+30;
SepRect.Right := StaticRect.Right;
//-6
SepRect.Left := StaticRect.Left;
FExtraPanel.ParentWindow :=
Handle;
FExtraPanel.BoundsRect := SepRect;
inherited DoShow;
end;
function TOpenOptionsDialog.Execute: Boolean;
begin
if NewStyleControls
and not (ofOldStyleDialog
in Options)
then
Template := '
EXTDLGTEMPLATE'
else
Template :=
nil;
Result :=
inherited Execute;
end;
function TSaveOptionsDialog.Execute: Boolean;
begin
if NewStyleControls
and not (ofOldStyleDialog
in Options)
then
Template := '
EXTDLGTEMPLATE'
else
Template :=
nil;
Result := DoExecute(@GetSaveFileName);
end;
procedure Register;
begin
RegisterComponents('
Moaddin', [TOpenOptionsDialog]);
RegisterComponents('
Moaddin', [TSaveOptionsDialog]);
end;
end.