Недавно добавленные исходники

•  Animation Loaders  807

•  DeLiKaTeS Tetris (Тетрис)  5 773

•  TDictionary Custom Sort  7 729

•  Fast Watermark Sources  7 408

•  3D Designer  10 630

•  Sik Screen Capture  7 943

•  Patch Maker  8 162

•  Айболит (remote control)  8 212

•  ListBox Drag & Drop  7 017

•  Доска для игры Реверси  100 389

•  Графические эффекты  8 286

•  Рисование по маске  7 661

•  Перетаскивание изображений  6 267

•  Canvas Drawing  6 641

•  Рисование Луны  6 564

•  Поворот изображения  5 721

•  Рисование стержней  4 660

•  Paint on Shape  3 362

•  Генератор кроссвордов  4 331

•  Головоломка Paletto  3 489

•  Теорема Монжа об окружностях  4 304

•  Пазл Numbrix  2 782

•  Заборы и коммивояжеры  3 711

•  Игра HIP  2 503

•  Игра Go (Го)  2 495

•  Симулятор лифта  2 890

•  Программа укладки плитки  2 323

•  Генератор лабиринта  3 049

•  Проверка числового ввода  2 554

•  HEX View  2 958

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Поиск в TMemo с использованием TFindDialog



Оформил: DeeCo

  private
     { Private declarations }
     FSelPos: integer;
   public
     { Public declarations }
   end;

 var
   Form1 : TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FindDialog1Find(Sender : TObject);
 var
   S : string;
   startpos : integer;
 begin
   with TFindDialog(Sender) do
   begin
     {If the stored position is 0 this cannot be a find next. }
     if FSelPos = 0 then
       Options := Options - [frFindNext];

      { Figure out where to start the search and get the corresponding 
       text from the memo. }
     if frfindNext in Options then
     begin
       { This is a find next, start after the end of the last found word. }
       StartPos := FSelPos + Length(Findtext);
       S := Copy(Memo1.Lines.Text, StartPos, MaxInt);
     end
     else
     begin
       { This is a find first, start at the, well, start. }
       S := Memo1.Lines.Text;
       StartPos := 1;
     end;
     { Perform a global case-sensitive search for FindText in S }
     FSelPos := Pos(FindText, S);
     if FSelPos > 0 then
     begin
        { Found something, correct position for the location of the start 
         of search. }
       FSelPos := FSelPos + StartPos - 1;
       Memo1.SelStart := FSelPos - 1;
       Memo1.SelLength := Length(FindText);
       Memo1.SetFocus;
     end
     else
     begin
       { No joy, show a message. }
       if frfindNext in Options then
         S := Concat('There are no further occurences of "', FindText,
           '" in Memo1.')
       else
         S := Concat('Could not find "', FindText, '" in Memo1.');
       MessageDlg(S, mtError, [mbOK], 0);
     end;
   end;
 end;

 // Show the FindDialog 
// Den FindDialog anzeigen 

procedure TForm1.Button1Click(Sender : TObject);
 begin
   FSelPos := 0;
   FindDialog1.Execute;
 end;




Похожие по теме исходники

Поисковик

Поиск символа

Поиск файлов

Поиск открытых файлов

 

Findup (поиск дублей)

Дейкстра: поиск кратчайшего пути

BTMemoryModule




Copyright © 2004-2026 "Delphi Sources" by «SiteAnalyzer». Delphi World FAQ

Группа ВКонтакте