![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как поймать курсор в RichEdit
zero-g © (2004-09-11 13:18:00)Здрасьте :)
Меня интересует как поймать курсор в RichEdit, т.е. номер ее место положения...
ArMellon (2004-09-11 13:26:00) [1]Если нужен номер линии
var
p:integer;
begin
p:=SendMessage(RichEdit1.Handle, EM_LINEFROMCHAR, RichEdit1.SelStart,0);
//p-номер строки
End;
ArMellon (2004-09-11 13:22:00) [2]Procedure TForm1.GetPosition(Sender: TRichEdit);
var
iX,iY : Integer;
TheRichEdit : TRichEdit;
begin
iX := 0; iY := 0;
TheRichEdit := TRichEdit(Sender);
iY := SendMessage(TheRichEdit.Handle, EM_LINEFROMCHAR, TheRichEdit.SelStart,
0);
iX := TheRichEdit.SelStart - SendMessage(TheRichEdit.Handle, EM_LINEINDEX,
iY, 0);
Panel1.Caption := IntToStr(iY + 1) + ':' + IntToStr(iX + 1) ;
end;
procedure TForm1.RichEditMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
GetPosition(RichEdit);
end;
procedure TForm1.RichEditKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
GetPosition(RichEdit);
end;
Rem (2004-09-11 13:20:00) [3]SelStart