diff --git a/UnitFormGrid.dfm b/UnitFormGrid.dfm index af2e09a..10fad6c 100644 --- a/UnitFormGrid.dfm +++ b/UnitFormGrid.dfm @@ -1,8 +1,8 @@ object FormGrid: TFormGrid Left = 0 Top = 0 - Width = 365 - Height = 340 + Width = 448 + Height = 418 AutoScroll = True Caption = 'FormGrid' Color = clBtnFace @@ -17,6 +17,13 @@ object FormGrid: TFormGrid OnClose = FormClose PixelsPerInch = 96 TextHeight = 13 + object Label1: TLabel + Left = 48 + Top = 228 + Width = 46 + Height = 13 + Caption = 'Pesquisa:' + end object StringGrid1: TStringGrid Left = 8 Top = 35 @@ -33,16 +40,17 @@ object FormGrid: TFormGrid object ToolBar1: TToolBar Left = 0 Top = 0 - Width = 349 + Width = 432 Height = 29 - ButtonHeight = 25 + ButtonHeight = 21 Caption = 'ToolBar1' TabOrder = 1 + ExplicitWidth = 349 object btExcluir: TButton Left = 0 Top = 0 Width = 70 - Height = 25 + Height = 21 Caption = 'Excluir' TabOrder = 0 OnClick = btExcluirClick @@ -51,11 +59,19 @@ object FormGrid: TFormGrid Left = 70 Top = 0 Width = 70 - Height = 25 + Height = 21 Caption = 'Escolher' Default = True TabOrder = 1 OnClick = btEscolherClick end end + object edPesquisa: TEdit + Left = 100 + Top = 225 + Width = 121 + Height = 21 + TabOrder = 2 + OnChange = edPesquisaChange + end end diff --git a/UnitFormGrid.pas b/UnitFormGrid.pas index 6b66ef3..c73d0e1 100644 --- a/UnitFormGrid.pas +++ b/UnitFormGrid.pas @@ -13,12 +13,16 @@ type ToolBar1: TToolBar; btExcluir: TButton; btEscolher: TButton; + edPesquisa: TEdit; + Label1: TLabel; procedure geraGrid(wLista: TLista; wClass: TClass); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure btExcluirClick(Sender: TObject); procedure btEscolherClick(Sender: TObject); + procedure edPesquisaChange(Sender: TObject); private { Private declarations } + palavra: string; public { Public declarations } end; @@ -64,6 +68,42 @@ begin end; +procedure TFormGrid.edPesquisaChange(Sender: TObject); +var + wString: string; + wCont: integer; + wObj: TObject; + wCont2: integer; + wCheckString: string; + wLista: TLista; +begin + palavra := edPesquisa.Text; + wCheckString := ''; + wLista := TLista.Create; + for wCont := 0 to FLista.Count-1 do + begin + wObj := FLista.getObjectByIndex(wCont); + if FClass = TCidade then + begin + with wObj as TCidade do + begin + for wCont2 := 1 to wCidade.Length do + begin + wCheckString := wCheckString + Copy(wCidade, wCont2, 1); + if wCheckString = palavra then + begin + ShowMessage(wCheckString); + wLista.Inserir(wObj, TCidade); + exit; + end; + end; + end; + end; + end; + FormGrid.geraGrid(wLista, TCidade); + +end; + procedure TFormGrid.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; diff --git a/Win32/Debug/Project1.exe b/Win32/Debug/Project1.exe index e51a305..281853d 100644 Binary files a/Win32/Debug/Project1.exe and b/Win32/Debug/Project1.exe differ diff --git a/Win32/Debug/UnitFormCidade.dcu b/Win32/Debug/UnitFormCidade.dcu index 2c62b13..1f18703 100644 Binary files a/Win32/Debug/UnitFormCidade.dcu and b/Win32/Debug/UnitFormCidade.dcu differ diff --git a/Win32/Debug/UnitFormEstado.dcu b/Win32/Debug/UnitFormEstado.dcu index a107a93..a1b4968 100644 Binary files a/Win32/Debug/UnitFormEstado.dcu and b/Win32/Debug/UnitFormEstado.dcu differ diff --git a/Win32/Debug/UnitFormGrid.dcu b/Win32/Debug/UnitFormGrid.dcu index d415206..8943903 100644 Binary files a/Win32/Debug/UnitFormGrid.dcu and b/Win32/Debug/UnitFormGrid.dcu differ diff --git a/Win32/Debug/UnitFormPais.dcu b/Win32/Debug/UnitFormPais.dcu index 884beb0..ea1ae58 100644 Binary files a/Win32/Debug/UnitFormPais.dcu and b/Win32/Debug/UnitFormPais.dcu differ