// "Einfügen" wird bei Edit1 verhindert.


// Getestet mit D4 unter XP

type 
  TForm1 = class(TForm) 
    Edit1: TEdit; 
    procedure FormCreate(Sender: TObject); 
    procedure FormDestroy(Sender: TObject); 
    procedure Edit1KeyDown(Sender: TObject; var Key: Word; 
      Shift: TShiftState); 
    procedure Edit1KeyPress(Sender: TObject; var Key: Char); 
  private 
    { Private-Deklarationen } 
  public 
    procedure apps(var Msg: TMsg; var Handled: Boolean); 
  end; 
 
var 
  Form1: TForm1; 
 
implementation 
 
{$R *.DFM} 
 
uses Menus; 
 
var 
  dummy: TPopupMenu; 
 
procedure TForm1.FormCreate(Sender: TObject); 
begin 
  Application.OnMessage := apps; 
  dummy := TPopupMenu.create(self); 
  Edit1.PopupMenu := dummy; 
end; 
 
procedure TForm1.apps(var Msg: TMsg; var Handled: Boolean); 
begin 
  if (Msg.message = WM_CONTEXTMENU) then handled := true 
  else inherited; 
end; 
 
procedure TForm1.FormDestroy(Sender: TObject); 
begin 
  dummy.free; 
end; 
 
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; 
  Shift: TShiftState); 
begin 
  if (key = VK_F10) and (ssShift in Shift) then key := 0; 
end; 
 
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key = #22 then key := #0; 
end;




 

Zugriffe seit 6.9.2001 auf Delphi-Ecke