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

•  DeLiKaTeS Tetris (Тетрис)  152

•  TDictionary Custom Sort  3 333

•  Fast Watermark Sources  3 084

•  3D Designer  4 842

•  Sik Screen Capture  3 336

•  Patch Maker  3 549

•  Айболит (remote control)  3 654

•  ListBox Drag & Drop  3 012

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

•  Графические эффекты  3 939

•  Рисование по маске  3 244

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

•  Canvas Drawing  2 747

•  Рисование Луны  2 575

•  Поворот изображения  2 184

•  Рисование стержней  2 168

•  Paint on Shape  1 568

•  Генератор кроссвордов  2 233

•  Головоломка Paletto  1 767

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

•  Пазл Numbrix  1 685

•  Заборы и коммивояжеры  2 056

•  Игра HIP  1 282

•  Игра Go (Го)  1 230

•  Симулятор лифта  1 474

•  Программа укладки плитки  1 216

•  Генератор лабиринта  1 547

•  Проверка числового ввода  1 363

•  HEX View  1 497

•  Физический маятник  1 358

 
скрыть


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-2024 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

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