首先声明一个全局变量
var
charbuffer:string;
procedure tform1.edit1keypress(sender:tobject;var key:char);
begin
label1.caption:=label1.caption+key;
key:=#0;
end;
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=vk_space then
begin
edit1.Text:=charbuffer;
charbuffer:='';
end;
end;