//RUTINAS DE TECLADO process Teclado(x,y,string texto_inicial) private int i; begin set_text_color(rgb(255,0,0)); if (teclado_activo) return; end teclado_activo=true; ip=texto_inicial; //set_text_color(rgb(255,10,10)); //ip="255.255.255.255"; text_ip_servidor=write_var(fuente,x,y,0,ip); keyer(); loop while ((i=NextKey())<>0) // asigna y compara a la vez // para ver los efectos uno a uno cambiar "while" por "if" switch (i) // tratamiento de los caracteres recibidos, ejemplo case 8: // si es la tecla borrar ... ip=substr(ip,0,-2);// ...se borra frame; end case 32..255: // si es caracter imprimible ... if (!false/*(i==46 || i==47 || i==34)*/) //no permito: ( /,\,.,") ni el punto ni las barras ni comillas if (len(ip)<17) ip+=chr(i); // ... se aņade end end end end end if (teclado_activo==false) /*delete_text(idnick);*/ break; end frame; end end process cajaroja(x,y,string texto_inicial) begin //file=fpgmenu; teclado(x,y,texto_inicial); //boton_aceptar(400,562); while (teclado_activo) frame; end end Process Keyer(); private aascii; begin keyBUf=""; loop //If (key(_esc)) exit("",0);End // asignacion virtual de ascii para incorporar las letras que ignora if (key(_del)) ascii=7;end if (key(_up)) ascii=14;end if (key(_down)) ascii=15;end if (key(_right))ascii=16;end if (key(_left)) ascii=17;end if (key(_home)) ascii=18;end if (key(_end)) ascii=19;end if (key(_enter)) teclado_activo=false; //set_text_color(rgb(130,100,256)); break; end // tratamiento de la variable ascii If (ascii>0) // si se pulsa tecla ... If (aascii<>ascii OR y<0) // ... si el caracter es distinto o se puede repetir ... KeyBuf+=chr(ascii); // ... aņade al buffer If (ascii==aascii) // si la tecla es la anterior ... y=1; // ... se espera poco (al mantener pulsada) Else // si no ... y=10; // se espera mas End; End; End; aascii=ascii;y--; // actualizacion de tecla anterior y de tiempo de espera if (!teclado_activo) break; end Frame; End; End; // Proceso que funciona como ascii pero despues de pasar por el manager Process NextKey() Private i; Begin If (len(Keybuf)==0) // Si no hay tecla en espera ... Return(0); // ... retorna 0 y sale End; i=asc(KeyBuf[0]); // coje el siguiente valor // quita este valor del buffer If (len(keybuf)==1) // si es el ultimo substr no funciona ... Keybuf=""; // ... asi que la limpia Else // sino ... Keybuf=substr(Keybuf,1,-1); // quita solo la primera letra End; Return(i); // retorna i (la tecla) End;