finalized 'search by name' function

This commit is contained in:
rickarof 2018-08-21 14:51:10 -03:00
parent 79d111221f
commit e4aa38a98b
10 changed files with 97 additions and 102 deletions

View File

@ -2,34 +2,34 @@
<BorlandProject> <BorlandProject>
<Transactions> <Transactions>
<Transaction>2018/08/02 11:30:33.000.203,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction> <Transaction>2018/08/02 11:30:33.000.203,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
<Transaction>2018/08/02 11:33:44.000.784,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Unit1.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormSplash.dfm</Transaction> <Transaction>2018/08/02 11:33:44.000.784,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormSplash.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Unit1.dfm</Transaction>
<Transaction>2018/08/02 11:33:44.000.784,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormSplash.pas</Transaction> <Transaction>2018/08/02 11:33:44.000.784,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormSplash.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
<Transaction>2018/08/02 11:34:22.000.896,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/02 11:34:22.000.896,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Project1.dproj</Transaction>
<Transaction>2018/08/02 11:34:57.000.485,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_Cadastro_Forms\UnitLista.pas</Transaction> <Transaction>2018/08/02 11:34:57.000.485,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_Cadastro_Forms\UnitLista.pas</Transaction>
<Transaction>2018/08/02 11:35:17.000.765,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_Cadastro_Forms\UnitLista.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitLista.pas</Transaction> <Transaction>2018/08/02 11:35:17.000.765,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitLista.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_Cadastro_Forms\UnitLista.pas</Transaction>
<Transaction>2018/08/02 11:35:39.000.518,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/02 11:35:39.000.518,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/02 11:37:42.000.005,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPadrao.pas</Transaction> <Transaction>2018/08/02 11:37:42.000.005,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPadrao.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/02 11:37:42.000.005,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPadrao.dfm</Transaction> <Transaction>2018/08/02 11:37:42.000.005,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPadrao.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm</Transaction>
<Transaction>2018/08/02 11:50:57.000.642,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/02 11:50:57.000.642,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/02 11:51:22.000.511,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormCidade.dfm</Transaction> <Transaction>2018/08/02 11:51:22.000.511,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormCidade.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/02 11:51:22.000.511,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormCidade.pas</Transaction> <Transaction>2018/08/02 11:51:22.000.511,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormCidade.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm</Transaction>
<Transaction>2018/08/02 11:54:03.000.448,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/02 11:54:03.000.448,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/03 07:57:41.000.908,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/03 07:57:41.000.908,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/03 07:59:28.000.101,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormEstado.dfm</Transaction> <Transaction>2018/08/03 07:59:28.000.101,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormEstado.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm</Transaction>
<Transaction>2018/08/03 07:59:28.000.101,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormEstado.pas</Transaction> <Transaction>2018/08/03 07:59:28.000.101,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormEstado.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/03 09:19:04.000.339,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/03 09:19:04.000.339,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/03 09:22:08.000.430,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPais.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/03 09:22:08.000.430,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPais.pas</Transaction>
<Transaction>2018/08/03 09:22:08.000.430,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPais.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm</Transaction> <Transaction>2018/08/03 09:22:08.000.430,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormPais.dfm</Transaction>
<Transaction>2018/08/03 11:37:12.000.927,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/03 11:37:12.000.927,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/03 12:44:44.000.083,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/03 12:44:44.000.083,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/06 10:32:04.000.123,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/06 10:32:04.000.123,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/06 10:39:43.000.299,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormGrid.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/06 10:39:43.000.299,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormGrid.dfm</Transaction>
<Transaction>2018/08/06 10:39:43.000.299,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormGrid.dfm=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.dfm</Transaction> <Transaction>2018/08/06 10:39:43.000.299,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitFormGrid.pas</Transaction>
<Transaction>2018/08/07 12:32:02.000.009,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/07 12:32:02.000.009,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/08 10:01:00.000.149,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitSharedVariables.pas</Transaction> <Transaction>2018/08/08 10:01:00.000.149,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitSharedVariables.pas</Transaction>
<Transaction>2018/08/08 10:50:02.000.574,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitSharedVariables.pas=</Transaction> <Transaction>2018/08/08 10:50:02.000.574,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitSharedVariables.pas=</Transaction>
<Transaction>2018/08/08 10:52:58.000.982,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/08 10:52:58.000.982,=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction>
<Transaction>2018/08/08 10:53:51.000.544,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitDados.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas</Transaction> <Transaction>2018/08/08 10:53:51.000.544,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Unit1.pas=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\UnitDados.pas</Transaction>
<Transaction>2018/08/08 12:16:26.000.969,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/08 12:16:26.000.969,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/08 14:58:46.000.344,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/08 14:58:46.000.344,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/14 14:54:15.000.469,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/14 14:54:15.000.469,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
@ -38,7 +38,7 @@
<Transaction>2018/08/15 15:04:40.000.526,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/15 15:04:40.000.526,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/16 11:06:43.000.602,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/16 11:06:43.000.602,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/17 12:26:51.000.000,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction> <Transaction>2018/08/17 12:26:51.000.000,C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj=C:\Users\programacaounico38\Documents\Embarcadero\Studio\Projects\Ex_CRUD\Project1.dproj</Transaction>
<Transaction>2018/08/21 09:38:54.903,C:\Users\programacaounico38\Documents\Projects\crud_delphi\Project1.dproj=C:\Users\programacaounico38\Documents\Projects\crud_delphi\Project1.dproj</Transaction> <Transaction>2018/08/21 09:38:54.000.903,C:\Users\programacaounico38\Documents\Projects\crud_delphi\Project1.dproj=C:\Users\programacaounico38\Documents\Projects\crud_delphi\Project1.dproj</Transaction>
</Transactions> </Transactions>
<ProjectSortOrder AutoSort="0" SortType="0"> <ProjectSortOrder AutoSort="0" SortType="0">
<File Path="UnitFormSplash.pas"/> <File Path="UnitFormSplash.pas"/>

View File

@ -1,10 +1,10 @@
[Stats] [Stats]
EditorSecs=55299 EditorSecs=60702
DesignerSecs=6553 DesignerSecs=6684
InspectorSecs=2305 InspectorSecs=2336
CompileSecs=338405 CompileSecs=360808
OtherSecs=1803 OtherSecs=2143
StartTime=03/08/2018 07:57:26 StartTime=03/08/2018 07:57:26
RealKeys=0 RealKeys=0
EffectiveKeys=0 EffectiveKeys=0
DebugSecs=24770 DebugSecs=27197

View File

@ -294,7 +294,7 @@ begin
inherited; inherited;
if wLista.Count > 0 then if wLista.Count > 0 then
begin begin
FormGrid := TFormGrid.Create(nil); FormGrid := TFormGrid.Create(FormCidade);
FormGrid.geraGrid(wLista, TCidade); FormGrid.geraGrid(wLista, TCidade);
FormGrid.Show; FormGrid.Show;
end; end;

View File

@ -18,22 +18,16 @@ object FormGrid: TFormGrid
OnCreate = FormCreate OnCreate = FormCreate
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object Label1: TLabel
Left = 48
Top = 228
Width = 46
Height = 13
Caption = 'Pesquisa:'
end
object StringGrid1: TStringGrid object StringGrid1: TStringGrid
Left = 8 Left = 0
Top = 35 Top = 59
Width = 265 Width = 265
Height = 184 Height = 184
ColCount = 4 ColCount = 4
DrawingStyle = gdsClassic
FixedCols = 0 FixedCols = 0
FixedRows = 0 FixedRows = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSelect] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goRowSelect]
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
@ -46,7 +40,6 @@ object FormGrid: TFormGrid
ButtonHeight = 21 ButtonHeight = 21
Caption = 'ToolBar1' Caption = 'ToolBar1'
TabOrder = 1 TabOrder = 1
ExplicitWidth = 349
object btExcluir: TButton object btExcluir: TButton
Left = 0 Left = 0
Top = 0 Top = 0
@ -68,9 +61,9 @@ object FormGrid: TFormGrid
end end
end end
object edPesquisa: TEdit object edPesquisa: TEdit
Left = 100 Left = 64
Top = 225 Top = 35
Width = 121 Width = 70
Height = 21 Height = 21
TabOrder = 2 TabOrder = 2
OnChange = edPesquisaChange OnChange = edPesquisaChange

View File

@ -14,14 +14,13 @@ type
btExcluir: TButton; btExcluir: TButton;
btEscolher: TButton; btEscolher: TButton;
edPesquisa: TEdit; edPesquisa: TEdit;
Label1: TLabel; procedure geraGrid(Lista: TLista; Classe: TClass);
procedure geraGrid(wLista: TLista; wClass: TClass);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btExcluirClick(Sender: TObject); procedure btExcluirClick(Sender: TObject);
procedure btEscolherClick(Sender: TObject); procedure btEscolherClick(Sender: TObject);
procedure edPesquisaChange(Sender: TObject); procedure edPesquisaChange(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure testeStringGrid(Lista: TLista; Classe: TClass); procedure testeStringGrid();
private private
{ Private declarations } { Private declarations }
palavra: string; palavra: string;
@ -39,25 +38,13 @@ implementation
{$R *.dfm} {$R *.dfm}
uses UnitFormCidade; uses UnitFormCidade;
procedure TFormGrid.testeStringGrid(Lista: TLista; Classe: TClass); procedure TFormGrid.testeStringGrid();
var
wCont: Integer;
wObj: TObject;
begin begin
for wCont := 0 to Lista.Count-1 do //ShowMessage(FormGrid.StringGrid1.Cells[0,0]);
begin StringGrid1.Cells[0, 0] := 'a';
wObj := Lista.getObjectByIndex(wCont); StringGrid1.Cells[1, 0] := 'a';
if Classe = TCidade then StringGrid1.Cells[2, 0] := 'a';
begin StringGrid1.Cells[3, 0] := 'a';
with wObj as TCidade do
begin
StringGrid1.Cells[0, wCont] := inttostr(wCod);
StringGrid1.Cells[1, wCont] := wCidade;
StringGrid1.Cells[2, wCont] := wPais;
StringGrid1.Cells[3, wCont] := wUF;
end;
end;
end;
end; end;
procedure TFormGrid.btEscolherClick(Sender: TObject); procedure TFormGrid.btEscolherClick(Sender: TObject);
@ -83,7 +70,6 @@ var
wObj: TObject; wObj: TObject;
begin begin
Index := StringGrid1.Row; Index := StringGrid1.Row;
wObj := FClass.Create;
try try
wObj := FLista.getObjectByIndex(Index); wObj := FLista.getObjectByIndex(Index);
FLista.Excluir(Index); FLista.Excluir(Index);
@ -97,44 +83,63 @@ procedure TFormGrid.edPesquisaChange(Sender: TObject);
var var
wCont: integer; wCont: integer;
wObj: TObject; wObj: TObject;
wCont2: integer;
wCheckString: string;
wLista: TLista; wLista: TLista;
wObj2: TObject; linha: integer;
I: Integer;
begin begin
palavra := edPesquisa.Text; palavra := edPesquisa.Text;
wLista := TLista.Create; if palavra <> '' then
for wCont := 0 to FLista.Count-1 do
begin
wObj := FLista.getObjectByIndex(wCont);
if FClass = TCidade then
begin
with wObj as TCidade do
begin
if ContainsText(wCidade, palavra) then
begin
ShowMessage('Resultado containstext:'+booltostr(ContainsText(wCidade, palavra)));
wLista.Inserir(wObj, TCidade);
end;
end;
end;
end;
ShowMessage('lista count:'+inttostr(wLista.Count));
for I := 0 to wLista.Count-1 do
begin
wObj2 := wLista.getObjectByIndex(I);
with wObj2 as TCidade do
begin
ShowMessage(wCidade);
end;
end;
if wLista.Count > 0 then
begin begin
FormGrid.testeStringGrid(wLista, TCidade); wLista := TLista.Create;
end; for wCont := 0 to FLista.Count-1 do
begin
wObj := FLista.getObjectByIndex(wCont);
if FClass = TCidade then
begin
with wObj as TCidade do
begin
if ContainsText(wCidade, palavra) then
begin
wLista.Inserir(wObj, TCidade);
end;
end;
end;
end;
if wLista.Count > 0 then
begin
for linha:= 1 to StringGrid1.RowCount -1 do
begin
StringGrid1.Rows[linha].Clear; //Cells[coluna,linha]:='';
end;
StringGrid1.RowCount := wLista.Count;
for wCont := 0 to wLista.Count-1 do
begin
wObj := wLista.getObjectByIndex(wCont);
with wObj as TCidade do
begin
StringGrid1.Cells[0, wCont] := inttostr(wCod);
StringGrid1.Cells[1, wCont] := wCidade;
StringGrid1.Cells[2, wCont] := wPais;
StringGrid1.Cells[3, wCont] := wUF;
end;
end;
end;
end
else
begin
StringGrid1.RowCount := Flista.Count;
for wCont := 0 to FLista.Count-1 do
begin
wObj := FLista.getObjectByIndex(wCont);
with wObj as TCidade do
begin
StringGrid1.Cells[0, wCont] := inttostr(wCod);
StringGrid1.Cells[1, wCont] := wCidade;
StringGrid1.Cells[2, wCont] := wPais;
StringGrid1.Cells[3, wCont] := wUF;
end;
end;
end;
end; end;
procedure TFormGrid.FormClose(Sender: TObject; var Action: TCloseAction); procedure TFormGrid.FormClose(Sender: TObject; var Action: TCloseAction);
@ -147,29 +152,26 @@ begin
checkList := true; checkList := true;
end; end;
procedure TFormGrid.geraGrid(wLista: TLista; wClass: TClass); procedure TFormGrid.geraGrid(Lista: TLista; Classe: TClass);
var var
wCont: integer; wCont: integer;
wObj: TObject; wObj: TObject;
begin begin
if checkList = true then if checkList = true then
begin begin
FLista := wLista; FLista := Lista;
FClass := wClass; FClass := Classe;
checkList := false; checkList := false;
end; end;
wObj := wClass.Create; ShowMessage('wLista count:'+inttostr(Lista.Count));
ShowMessage('wLista count:'+inttostr(wLista.Count)); StringGrid1.RowCount := Lista.Count;
//StringGrid1.RowCount := wLista.Count; for wCont := 0 to Lista.Count-1 do
for wCont := 0 to wLista.Count-1 do
begin begin
wObj := wLista.getObjectByIndex(wCont); wObj := Lista.getObjectByIndex(wCont);
// fazer uma condição para cada tipo de Classe existente // fazer uma condição para cada tipo de Classe existente
if wObj.ClassType = TCidade then if wObj.ClassType = TCidade then
with wObj as TCidade do with wObj as TCidade do
begin begin
ShowMessage('cod:'+inttostr(wCod));
ShowMessage('testestring:'+wCidade);
StringGrid1.Cells[0, wCont] := inttostr(wCod); StringGrid1.Cells[0, wCont] := inttostr(wCod);
StringGrid1.Cells[1, wCont] := wCidade; StringGrid1.Cells[1, wCont] := wCidade;
StringGrid1.Cells[2, wCont] := wPais; StringGrid1.Cells[2, wCont] := wPais;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.