Link to home
Start Free TrialLog in
Avatar of Aliev
AlievFlag for Azerbaijan

asked on

How to view the word under the mouse in richedit.

Hi, experts. My question is about WinAPI.
2 components in the form: RichEdit and Label
How to make that when mouse over the rich edit in label caption shows word under the mouse cursor(in richedit).
I seen this example on the internet and used it works. But now i cant find it. Help please. Thanks....
Regards,
Adil Aliev,
Baku, Azerbaijan,
adil@aliev.info
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi, is that the site you are looking for??

http://delphi.about.com/bltip1203.htm
Avatar of Aliev

ASKER

Thanks and how i can do it not on other components?

(TWebBrowser, Memo ...)
Avatar of Aliev

ASKER

Previous comment was incorrect
Thanks and how i can do it on other components?

(TWebBrowser, Memo ...)
In a TMEMO you can do that on a MouseDown

procedure TForm1.Memo1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var row,col : integer;
    t       : string;
    i,j     : integer;
begin
    Row := SendMessage(Tmemo(Sender).Handle, EM_LineFromChar, Tmemo(Sender).SelStart, 0);
    Col := Tmemo(Sender).SelStart - SendMessage(Tmemo(Sender).Handle, EM_LineIndex, Row, 0);
    t:=Tmemo(Sender).lines[row];
    i:=col;
    j:=col;
    while (i>0) and (copy(t,i,1)<>' ') do dec(i,1);
    while (j<=length(t)) and (copy(t,j,1)<>' ') do inc(j,1);
    inc(i,1);
    t:=copy(t,i,j-i);
    Label1.caption := t;
end;
Avatar of Aliev

ASKER

And on TWebBrowser???
Dear friend...your question was 'How to view the word under the mouse in richedit' and it was answered, then another additional about TMemo had a solution too...
Well, i think that should be better to accept first the answer and award points before to ask additional questions...
Then remember: usually one question for one answer in one thread....

F68