Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 26-10-2005
RaulRuiz RaulRuiz is offline
Miembro
 
Registrado: jul 2004
Ubicación: Málaga - Spain
Posts: 11
Poder: 0
RaulRuiz Va por buen camino
Acabo de encontrarlo!!! (o al menos eso creo).

En delphi.about.com he encontrado un artículo: 'What's the word under the mouse cursor in a TRichedit' .

Tiene buena pinta.

Muchas gracias
Responder Con Cita
  #2  
Antiguo 26-10-2005
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.141
Poder: 36
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

La solución, digna de estudio (creo yo), la encontré escrita por Thomas Stutz en su ejemplo: Drag & Drop items from a TListBox to a TRichEdit?

Copio a continuación el código de Thomas Stutz por considerarlo merecido y útil:

Código Delphi [-]
 function RECharIndexByPos(RichEdit: TRichEdit; X, Y: Integer): Integer;
 var
   P: TPoint;
 begin
   P := Point(X, Y);
   Result := SendMessage(RichEdit.Handle, EM_CHARFROMPOS, 0, Longint(@P));
 end;
 
 
 procedure TForm1.RichEdit1DragOver(Sender, Source: TObject; X, Y: Integer;
   State: TDragState; var Accept: Boolean);
 var
   P: TPoint;
 begin
   // Check, if Source is ListBox1
   Accept := Source = ListBox1;
   if GetCursorPos(P) then
     with RichEdit1 do
     begin
       // Get the Index from Mouse Position
       P := ScreenToClient(P);
       SelStart := RECharIndexByPos(RichEdit1, P.X, P.Y);
       SetFocus;
     end;
 end;
 
 procedure TForm1.RichEdit1DragDrop(Sender, Source: TObject; X, Y: Integer);
 begin
   // finally insert text at mouse position
   RichEdit1.SelText := ListBox1.Items[ListBox1.ItemIndex];
 end;
__________________
David Esperalta
www.decsoftutils.com

Última edición por dec fecha: 26-10-2005 a las 10:47:31. Razón: Añadir código fuente.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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


La franja horaria es GMT +2. Ahora son las 05:25:28.


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