Autor Beitrag
bruce185
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Mo 20.02.06 11:34 
Hi,
Ich wollte mal fragen wie man in RichEdit1 auf ein bestimmte Text Klicken kann, geht das mit dem normalen RichEdit Komponent?

Also, z.B. wenn in RichEdit jetzt im Text sowas steht /N und wenn ich dann mit der Maus drauf klicke, dann soll das /N in Edit eingefügt werden.

Ich danke euch schonmal für die hilfe 8)

Gruss Andreas


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 20.02.2006 um 14:23
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 20.02.06 12:06 
Hallo,
der folgende Code gibt dir das Zeichen unter dem Maus-Cursor aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var aPoint : TPoint;
         i : Integer;
begin
  with Richedit1 do
    begin
    aPoint := Point(X,Y);
    i := Perform(Messages.EM_CHARFROMPOS,0,Integer(@aPoint));
    showmessage(Text[i]);
    end;
end;
Dann suchst Du noch das erste Leerzeichen vor und hinter der Position i, damit hast Du Dein Wort lokalisiert und kannst es in ein Edit setzen.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
bruce185 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Mo 20.02.06 13:05 
Ich bin dir seher danbar für die hilfe.
Aber wie mache ich das Jetzt das es ein komplettes Wort erkennt?

z.B. Hallo, Hi oder Gut

ich danke dir schonmal 8)

Gruss Andreas
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 20.02.06 13:50