Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 17-11-2008
lucho1981 lucho1981 is offline
Miembro
 
Registrado: abr 2006
Ubicación: Tucuman-Argentina
Posts: 44
Poder: 0
lucho1981 Va por buen camino
Thumbs down Cambio de caracteres

Hola gente linda, tengo una duda al hacer un programita.
Hace años vi uno parecido y siempre quise hacer algo similar.
Este programita consistia en escribir en un edit una pregunta, y el programita te la respondia solo y siempre acertaba.
la cosa era q en un edit escribias LA RESPUESTA A LA PREGUNTA seguido de la pregunta, pero en el edit solo se escribia el nombre del programa seguido de la pregunta.
No se si me explico bien. Por ejemplo si uno queria preguntarle:
cual es la capital de españa?
debia escribir madrid cual es la capital de españa?
Y en el edit debia aparecer NOMBREDELPROGRAMA cual es la capital de españa?
Donde NOMBREDEPROGRAMA es un nombre q le ponemos al programa, en mi caso Luchito.
A continuacion adjunto el codigo de evento onkeypress del edit
Código Delphi [-]
If  ((key<>' ') and (edit2.text='0')) then
  begin
    if (edit1.Text='L') then
      begin
        edit3.Text:=edit3.Text+key;
        edit1.Text:=edit1.text+'u';
      end;
    if (edit1.Text='') then
      begin
        edit3.Text:=key;
        edit1.Text:='L';
      end;
    if (edit1.text='Lu') then
      begin
        edit3.Text:=edit3.Text+key;
        edit1.text:=edit1.Text+'c';
      end;
   if (edit1.Text='Luc') then
      begin
        edit3.Text:=edit3.Text+key;
        edit1.Text:=edit1.Text+'h';
      end;
    if (edit1.Text='Luch') then
      begin
        edit3.Text:=edit3.Text+key;
        edit1.Text:=edit1.Text+'i';
      end;
    if (edit1.Text='Luchi') then
      begin
        edit3.Text:=edit3.Text+key;
        edit1.Text:=edit1.Text+'t';
      end;
  if (edit1.Text='Luchit') then
    begin
      edit3.text:=edit3.Text+key;
      edit1.Text:=edit1.Text+'o';
    end;
  if (edit1.Text='Luchito') then
    begin
      edit3.Text:=edit3.Text+key;
    end;
  end
else
  begin
    if (edit2.Text='0') then
      begin
        edit2.Text:='1';
        edit1.Text:='Luchito ';
      end
    else
      edit1.Text:=edit1.Text+key;
  end;
El error q me da es q escribe la primera letra de la respuesta.
Ej:
Madrid cual es la capital de españa?
Escribe ML
Alguien me puede dar una solucion? o si debo poner el codigo en otro lugar q no sea el evento onkeypress? Gracias
Responder Con Cita
  #2  
Antiguo 17-11-2008
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 25
Caral Va por buen camino
Hola
Tal vez algo asi.
Saludos
__________________
Siempre Novato

Última edición por Caral fecha: 19-11-2008 a las 18:54:44.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Cambio de cursor... The_Avatar OOP 6 04-02-2008 19:22:20
El cambio de Usuario de Windows Me cambio el Delphi!! El_Raso Varios 5 22-11-2006 17:27:02
Cambio de Fuente buitrago_listas Varios 1 02-11-2004 17:06:33
Cambio de IB6 a FB1.5 afxe Firebird e Interbase 0 13-07-2004 17:01:03
Cambio del registro soul6301 Varios 1 06-06-2004 09:42:02


La franja horaria es GMT +2. Ahora son las 07:17:04.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi