program tecatele;
uses
crt;
const
nume : array[1..12] of char = ('0','1','2','3','4','5','6','7','8','9',
'#','*');
var
tecla : char;
datoen : string[4];
todo : string;
x0, y0, tt, x3, y3 : integer;
procedure teclado;
var
y, x : integer;
begin
textcolor(15);
x := 5;
y := 3;
gotoxy(x,y);write('teclado de telefono celular');
x := 10;
gotoxy(x,y + 3);write('[','0',']',' ','[','1',']',' ','[','2',']');
textcolor(10);
gotoxy(x,y + 4);write(' 0 ',' .,?',' abc');
textcolor(15);
gotoxy(x,y + 6);write('[','3',']',' ','[','4',']',' ','[','5',']');
textcolor(10);
gotoxy(x,y + 7);write('def',' ghi',' jkl');
textcolor(15);
gotoxy(x,y + 9);write('[','6',']',' ','[','7',']',' ','[','8',']');
textcolor(10);
gotoxy(x,y + 10);write('mno',' pqrs',' tuv');
textcolor(15);
gotoxy(x,y + 12);write('[','9',']',' ','[','#',']',' ','[','*',']');
textcolor(10);
gotoxy(x,y + 13);write('wxyz',' esp.',' m/M');
end;
procedure entradas;
var
linea, az, cual, dd, x1, y1 : integer;
letra, ante : char;
no, mayu : boolean;
begin
teclado;
mayu := false;
no := false;
dd := 1;
x1 := 10;
y1 := 18;
az := 1;
textcolor(12);
gotoxy(x1,y1);write('Entrada Texto Teclado Numerico');
textcolor(15);
y1 := 19;
x3 := x1;
y3 := y1;
gotoxy(x1,y1);
cual := 0;
linea := 0;
ante := ' ';
letra := ' ';
repeat
tecla := readkey;
if tecla in[#48..#57,#35,#42] then
begin
ante := tecla;
tecla := #0;
cual := cual + 1;
az := 1;
repeat
if keypressed then
tecla := readkey;
if tecla = ante then
begin
az := 1;
cual := cual + 1;
ante := tecla;
tecla := #0;
end;
delay(3);
az := az + 1;
until az > 60;
end;
case ante of
#48 : letra := '0';
#49 : begin
letra := ' ';
case cual of
1 : letra := '.';
2 : letra := ',';
3 : letra := '?';
4 : letra := '1';
end;
end;
#50 : begin
letra := ' ';
case cual of
1 : letra := 'a';
2 : letra := 'b';
3 : letra := 'c';
4 : letra := '2';
end;
end;
#51 : begin
letra := ' ';
case cual of
1 : letra := 'd';
2 : letra := 'e';
3 : letra := 'f';
4 : letra := '3';
end;
end;
#52 : begin
letra := ' ';
case cual of
1 : letra := 'g';
2 : letra := 'h';
3 : letra := 'i';
4 : letra := '4';
end;
end;
#53 : begin
letra := ' ';
case cual of
1 : letra := 'j';
2 : letra := 'k';
3 : letra := 'l';
4 : letra := '5';
end;
end;
#54 : begin
letra := ' ';
case cual of
1 : letra := 'm';
2 : letra := 'n';
3 : letra := 'o';
4 : letra := '6';
end;
end;
#55 : begin
letra := ' ';
case cual of
1 : letra := 'p';
2 : letra := 'q';
3 : letra := 'r';
4 : letra := 's';
5 : letra := '7';
end;
end;
#56 : begin
letra := ' ';
case cual of
1 : letra := 't';
2 : letra := 'u';
3 : letra := 'v';
4 : letra := '8';
end;
end;
#57 : begin
letra := ' ';
case cual of
1 : letra := 'w';
2 : letra := 'x';
3 : letra := 'y';
4 : letra := 'z';
5 : letra := '9';
end;
end;
#35 : letra := #32;
#42 : begin
if mayu = false then
mayu := true
else
mayu := false;
no := true;
letra := ' ';
end;
end;
cual := 0;
if (no = false) and (tecla <> #13) then
begin
if mayu = false then
letra := letra
else
letra := upcase(letra);
todo[dd] := letra;
todo[0] := chr(dd);
gotoxy(x1 + linea,y1);write(todo[dd]);
dd := dd + 1;
linea := linea + 1;
if linea > 15 then
begin
y1 := y1 + 1;
x1 := x3;
gotoxy(x1,y1);
linea := 0;
todo[dd] := #13;
todo[0] := chr(dd);
dd := dd + 1;
end;
end
else
begin
no := false;
end;
until tecla = #13;
end;
begin
clrscr;
entradas;
gotoxy(x3,y3);clreol;
textcolor(10);
x0 := x3 - 1;
y0 := y3;
for tt := 1 to length(todo) do
begin
if todo[tt] = #13 then
begin
y0 := y0 + 1;
x0 := x3 - 1;
end;
gotoxy(x0,y0);write(todo[tt]);
x0 := x0 + 1;
end;
readln;
end.