jak zadeklarowac globalna zmienna?
oto kod programu:
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, FileCtrl, ImgList, ComCtrls, ShellAPI, DBLookup, ExtCtrls;
type
TFormOtworz = class(TForm)
btnOtworz: TButton;
Drive: TDriveComboBox;
btnAnuluj: TButton;
DirList: TDirectoryListBox;
ListView: TListView;
ImageList1: TImageList;
Maska: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Zmiana: TTimer;
procedure btnAnulujClick(Sender: TObject);
procedure Otworz(Dir: String; Maska: String);
procedure DirListChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormOtworz: TFormOtworz;
implementation
uses Unit1;
{$R *.DFM}
procedure TFormOtworz.btnAnulujClick(Sender: TObject);
begin
Close;
end;
procedure TFormOtworz.Otworz(Dir, Maska: String);
var
SR : TSearchRec; // rekord
List : TListItem; // pozycja w ListView
Found : Integer; // zmienna oznacza ilosc znalezionych plikow
I : WORD;
Icon : TIcon; // ikona
begin
I := 0;
ListView.Items.Clear;
Icon := TIcon.Create; // tworzy ikone danego pliku
Icon.Handle := ExtractAssociatedIcon(hInstance, PChar(Dir + '' + Maska), i);
ImageList1.InsertIcon(0, Icon); // dorzucamy ikonke
Found := FindFirst(Dir + '' + Maska, faAnyFile, SR);
while ( Found = 0) do
begin
List := ListView.items.Add;
List.Caption := Dir + '' + SR.Name; // pozycja
List.SubItems.Add(IntToStr(SR.Size) + 'bajtow');
List.ImageIndex := 0;
Found := FindNext(SR);
end;
FindClose(SR);
end;
end.
i teraz chce aby w komponencie ListView pokazywaly sie pliki o rozszerzeniu podnym w polu Edit o nazwie Maska. Gdy dalem event komponentu ListBox zeby je wyszukiwal po jazdej zmianie te pliki to po pewnym czasie sie program zawieszal :9