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

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

•  TDictionary Custom Sort  3 307

•  Fast Watermark Sources  3 057

•  3D Designer  4 810

•  Sik Screen Capture  3 307

•  Patch Maker  3 524

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

•  ListBox Drag & Drop  2 985

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

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

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

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

•  Canvas Drawing  2 726

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

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

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

•  Paint on Shape  1 562

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

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

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

•  Пазл Numbrix  1 678

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

•  Игра HIP  1 274

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

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

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

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

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

•  HEX View  1 485

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

 
скрыть


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

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



Delphi Sources

Глобальный поиск компонента





unit FindGlob;

interface

uses
  Classes, DsgnIntf, Forms, SysUtils;

function FindGlobalComp (const Name: string;
  List: TComponentList): Boolean;

implementation

function FindGlobalComp (const Name: string;
  List: TComponentList): Boolean;
var
  I, J, InitCount: Integer;
  Form, Comp: TComponent;
begin
  InitCount := List.Count;
  for I := 0 to Screen.FormCount - 1 do
  begin
    Form := Screen.Forms[I];
    if CompareText(Name, Form.Name) = 0 then
      List.Add (Form);
    for J := 0 to Form.ComponentCount - 1 do
    begin
      Comp := Form.Components [J];
      if CompareText(Name, Comp.Name) = 0 then
        List.Add (Comp);
    end;
  end;
  for I := 0 to Screen.DataModuleCount - 1 do
  begin
    Form := Screen.DataModules[I];
    if CompareText(Name, Form.Name) = 0 then
      List.Add (Form);
    for J := 0 to Form.ComponentCount - 1 do
    begin
      Comp := Form.Components [J];
      if CompareText(Name, Comp.Name) = 0 then
        List.Add (Comp);
    end;
  end;
  // true if found
  Result := (List.Count - InitCount) > 0;
end;

end.


unit FindForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses
  FindGlob, DsgnIntf;

procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
  Comp: TComponent;
  List: TComponentList;
begin
  ListBox1.Items.Clear;
  List := TComponentList.Create;
  try
    if not FindGlobalComp (Edit1.Text, List) then
      ListBox1.Items.Add ('No components found')
    else
      for I := 0 to List.Count - 1 do
      begin
        Comp := List.Items[I] as TComponent;
        ListBox1.Items.Add (Format (
          '%s (%s): %s (%s)',
          [Comp.Name, Comp.ClassName,
          Comp.Owner.Name, Comp.Owner.ClassName]));
      end;
  finally
    List.Free;
  end;
end;

end.


unit SecondF;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Edit1: TEdit;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

end.

Загрузить весь проект





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

Поисковик

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

Поиск файлов

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

 

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

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

Расширение компонента TEdit




Copyright © 2004-2024 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

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