Thread: TFindDialog

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    TFindDialog


    Hey people. I am new to this site and i subscribed just for help. My school teacher assigned me a project in which i need to develop a windows notepad like application. So everything went well and i didn't came across any difficulties apart from finding text in the memo lines using a TFindDialog. I have searched the Internet and found some code which i didn't understand very well. So i decided to write my own. The problem is that i don't know how to get the index of the last line of the memo. Here is my code(I don't know if it works i am just experimenting)

    procedure TForm1.FindDialog1Find(Sender: TObject);
    var
    i : integer;
    begin
    for i := Memo1.CaretPos.Y to {Here i want to put the index of the last line} do
    if pos(FindDialog1.FindText,Memo1.Lines[i]) <> 0 then
    begin
    Memo1.SelStart := pos(FindDialog1.FindText,Memo1.Lines[i]) - 1;
    Memo1.SelLength := length(FindDialog1.FindText);
    Memo1.SetFocus;
    end;
    end;



    By the way i am relatively new to the delphi programming...
    Sorry for my English!!!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    I am not commenting on the rest of your code; but the answer to your question is:
    Code:
    memo1.lines[memo1.lines.count-1]
    Clive

IMN logo majestic logo threadwatch logo seochat tools logo