Вниз
Скачать: CL | DM;

Как зная координаты каретки в Memo получить индекс ?   Найти похожие ветки 

 
Alex_C ©   (2006-10-16 14:29) [0]

Как зная Memo.CaretPos получить индекс относительно начала текста (тот что согласуется с SelStart)?


 
han_malign ©   (2006-10-16 14:32) [1]

function EMCaretPos(Handle: THandle): Integer;
var
  P: TPoint;
begin
  Windows.GetCaretPos(P);
  Result:=SendMessage(Handle,EM_CHARFROMPOS,0,MakeLong(P.X, P.Y));
end;


 
Джо ©   (2006-10-16 14:33) [2]

EM_CHARFROMPOS


 
Джо ©   (2006-10-16 14:34) [3]

> [2] Джо ©   (16.10.06 14:33)
> EM_CHARFROMPOS

Не видел [1].


 
Alex_C ©   (2006-10-16 14:35) [4]

То 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;

Почему?


 
Ketmar ©   (2006-10-16 18:27) [5]

справку читаем, ага?
The return value specifies the character index in the low-order word and the line index in the high-order word.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.033 c
11-1132569120
Reset
2005-11-21 13:32
2006.10.29
Подсказка-"шарик" у иконки трея


15-1159960137
Тульский
2006-10-04 15:08
2006.10.29
Переводчик On-Line


1-1158506506
Still Swamp
2006-09-17 19:21
2006.10.29
Как осуществить сдвиг с переносом для 64 битного значения?


15-1160381382
kot andrei
2006-10-09 12:09
2006.10.29
бесплатный англо-русский словарь


15-1160328089
ArtemESC
2006-10-08 21:21
2006.10.29
ObjectPascal на 64x




   Наверх