For programs that use FMX, FmxBeepButton must be defined in the project defines.
//unit BeepButton;
// This is BeepButton.INC
interface
uses
{$IFDEF FmxBeepButton}
FMX.Types, BeepButtonFmxAncestor
{$ELSE}
BeepButtonVclAncestor
{$ENDIF}
;
Type
TBeepButton = class(TCustomBeepButton)
public
procedure Click; override;
end;
implementation
{ TBeepButton }
procedure TBeepButton.Click;
begin
inherited;
DoBeep;
end;
end.
unit BeepButtonFmxAncestor;
interface
uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls,
FMX.Controls.Presentation, FMX.StdCtrls;
type
TCustomBeepButton = class(TButton)
private
{ Private declarations }
protected
procedure DoBeep;
{ Protected declarations }
public
constructor Create(AOwner: TComponent); override;
{ Public declarations }
published
property Position;
{ Published declarations }
end;
implementation
{ TCustomBeepButton }
constructor TCustomBeepButton.Create(AOwner: TComponent);
begin
inherited;
StyleLookup := 'Buttonstyle'
end;
procedure TCustomBeepButton.DoBeep;
begin
Beep;
end;
end.
unit BeepButtonVclAncestor;
interface
uses
System.SysUtils, System.Classes, Vcl.Controls, Vcl.StdCtrls;
type
TCustomBeepButton = class(TButton)
private
{ Private declarations }
protected
procedure DoBeep;
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
implementation
{ TCustomBeepButton }
procedure TCustomBeepButton.DoBeep;
begin
Beep;
end;
end.
unit VCL.BeepButton;
{$INCLUDE BeepButton.INC}
unit VCL.BeepButtonRegister;
interface
uses
Classes, Vcl.Controls, VCL.BeepButton;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TBeepButton]);
GroupDescendentsWith(TBeepButton, Vcl.Controls.TControl);
end;
end.
unit VCL.BeepButton;
{$INCLUDE BeepButton.INC}
unit VCL.BeepButtonRegister;
interface
uses
Classes, Vcl.Controls, VCL.BeepButton;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TBeepButton]);
GroupDescendentsWith(TBeepButton, Vcl.Controls.TControl);
end;
end.