![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как зная координаты каретки в Memo получить индекс ? [D7, XP]
Alex_C © (2006-10-16 14:29:00)Как зная Memo.CaretPos получить индекс относительно начала текста (тот что согласуется с SelStart)?
Ketmar (2006-10-16 18:27:00) [1]справку читаем, ага?
The return value specifies the character index in the low-order word and the line index in the high-order word.
Alex_C (2006-10-16 14:35:00) [2]То han_maling: так не работает, работает так:
function GetMemoCaretIndex( ControlMemo: TMemo ) : Integer;
var
P: TPoint;
begin
Windows.GetCaretPos(P);
Result:= SendMessage(ControlMemo.Handle,EM_CHARFROMPOS,0,MakeLong(Word(P.X), Word(P.Y))) - ControlMemo.CaretPos.Y*65536;
end;
Почему?
Джо (2006-10-16 14:34:00) [3]> [2] Джо © (16.10.06 14:33)
> EM_CHARFROMPOS
Не видел [1].
Джо (2006-10-16 14:33:00) [4]EM_CHARFROMPOS
han_malign (2006-10-16 14:32:00) [5]
function EMCaretPos(Handle: THandle): Integer;
var
P: TPoint;
begin
Windows.GetCaretPos(P);
Result:=SendMessage(Handle,EM_CHARFROMPOS,0,MakeLong(P.X, P.Y));
end;