I am doing a search in a Tmemo with the following codeFindInMemo has a little bug:This gives me a number which is from the start of the Tmemo.
function TForm_Test.FindInMemo(AMemo: TMemo; AString: String; StartPos: Integer): Integer; begin Result := PosEx(AString, AMemo.Text, StartPos); if Result > 0 then begin AMemo.SelStart := UTF8Length(PChar(AMemo.Text), Result - 1); AMemo.SelLength := Length(AString); AMemo.SetFocus; end; // if end; // FindInMemo
But how can I determine the linenumber from this?For Windows, use SendMessage:
I found this but this is for Delphi and not Lazarus.
mi := Memo_Test.Perform(EM_LINEFROMCHAR, i, 0);