unit HasFormat;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ClipBrd;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: HasFormat
// Method: Clipbrd.TClipboard.HasFormat
// Method: Clipbrd.TClipboard.Clear
// Property: Clipbrd.TClipboard.AsText

// BeginCode
{
This example uses a button and an TEdit on a form. When the
user clicks the button, any text on the clipboard is pasted
into the TEdit.  If there is no text on the clipboard, a 
message box appears.
Note:  To use this example, you must add Clipbrd to the uses
clause.  Load the Clipboard by performing a copy in any 
application.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Clipboard.HasFormat(CF_TEXT) then
  begin
  Edit1.Text := Clipboard.AsText;
  Clipboard.Clear;
  end
else
  MessageDlg(
    'There is no text on the Clipboard', 
    mtInformation, [mbOK],0);
end;
// EndCode
// EndExample: HasFormat
end.
