mirror of
https://github.com/rickrd/crud-delphi.git
synced 2025-12-19 09:03:43 +01:00
added 'search by grid column' function
This commit is contained in:
parent
89639700ce
commit
abc715fd8d
@ -9,7 +9,9 @@ uses
|
|||||||
UnitFormEstado in 'UnitFormEstado.pas' {FormEstado},
|
UnitFormEstado in 'UnitFormEstado.pas' {FormEstado},
|
||||||
UnitFormPais in 'UnitFormPais.pas' {FormPais},
|
UnitFormPais in 'UnitFormPais.pas' {FormPais},
|
||||||
UnitFormGrid in 'UnitFormGrid.pas' {FormGrid},
|
UnitFormGrid in 'UnitFormGrid.pas' {FormGrid},
|
||||||
UnitDados in 'UnitDados.pas';
|
UnitDados in 'UnitDados.pas',
|
||||||
|
Vcl.Themes,
|
||||||
|
Vcl.Styles;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@
|
|||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base)'!=''">
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
|
<Custom_Styles>Amakrits|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Amakrits.vsf;"Amethyst Kamri|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\AmethystKamri.vsf";"Aqua Graphite|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\AquaGraphite.vsf";"Aqua Light Slate|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\AquaLightSlate.vsf";Auric|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Auric.vsf;Carbon|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Carbon.vsf;"Charcoal Dark Slate|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\CharcoalDarkSlate.vsf";"Cobalt XEMedia|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\CobaltXEMedia.vsf";"Cyan Dusk|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\CyanDusk.vsf";"Cyan Night|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\CyanNight.vsf";"Emerald Light Slate|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\EmeraldLightSlate.vsf";Glossy|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Glossy.vsf;Glow|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Glow.vsf;"Golden Graphite|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\GoldenGraphite.vsf";"Iceberg Classico|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\IcebergClassico.vsf";"Lavender Classico|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\LavenderClassico.vsf";Light|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Light.vsf;Luna|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Luna.vsf;"Metropolis UI Black|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\MetropolisUIBlack.vsf";"Metropolis UI Blue|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\MetropolisUIBlue.vsf";"Metropolis UI Dark|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\MetropolisUIDark.vsf";"Metropolis UI Green|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\MetropolisUIGreen.vsf";Obsidian|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Obsidian.vsf;"Onyx Blue|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\OnyxBlue.vsf";"Ruby Graphite|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\RubyGraphite.vsf";"Sapphire Kamri|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\SapphireKamri.vsf";Silver|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Silver.vsf;Sky|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Sky.vsf;"Slate Classico|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\SlateClassico.vsf";"Smokey Quartz Kamri|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\SmokeyQuartzKamri.vsf";"Tablet Light|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\TabletLight.vsf";TabletDark|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\TabletDark.vsf;"Turquoise Gray|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\TurquoiseGray.vsf";Windows10|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Windows10.vsf;"Windows10 Blue|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Windows10Blue.vsf";"Windows10 Dark|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\17.0\Styles\Windows10Dark.vsf"</Custom_Styles>
|
||||||
<SanitizedProjectName>Project1</SanitizedProjectName>
|
<SanitizedProjectName>Project1</SanitizedProjectName>
|
||||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||||
@ -157,12 +158,27 @@
|
|||||||
<Overwrite>true</Overwrite>
|
<Overwrite>true</Overwrite>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployFile>
|
</DeployFile>
|
||||||
<DeployClass Name="ProjectiOSDeviceResourceRules">
|
<DeployClass Name="DependencyModule">
|
||||||
|
<Platform Name="Win32">
|
||||||
|
<Operation>0</Operation>
|
||||||
|
<Extensions>.dll;.bpl</Extensions>
|
||||||
|
</Platform>
|
||||||
<Platform Name="iOSDevice64">
|
<Platform Name="iOSDevice64">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
|
<Extensions>.dylib</Extensions>
|
||||||
|
</Platform>
|
||||||
|
<Platform Name="OSX32">
|
||||||
|
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||||
|
<Operation>1</Operation>
|
||||||
|
<Extensions>.dylib</Extensions>
|
||||||
</Platform>
|
</Platform>
|
||||||
<Platform Name="iOSDevice32">
|
<Platform Name="iOSDevice32">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
|
<Extensions>.dylib</Extensions>
|
||||||
|
</Platform>
|
||||||
|
<Platform Name="iOSSimulator">
|
||||||
|
<Operation>1</Operation>
|
||||||
|
<Extensions>.dylib</Extensions>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployClass>
|
</DeployClass>
|
||||||
<DeployClass Name="ProjectOSXResource">
|
<DeployClass Name="ProjectOSXResource">
|
||||||
@ -516,27 +532,12 @@
|
|||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployClass>
|
</DeployClass>
|
||||||
<DeployClass Name="DependencyModule">
|
<DeployClass Name="ProjectiOSDeviceResourceRules">
|
||||||
<Platform Name="Win32">
|
|
||||||
<Operation>0</Operation>
|
|
||||||
<Extensions>.dll;.bpl</Extensions>
|
|
||||||
</Platform>
|
|
||||||
<Platform Name="iOSDevice64">
|
<Platform Name="iOSDevice64">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
<Extensions>.dylib</Extensions>
|
|
||||||
</Platform>
|
|
||||||
<Platform Name="OSX32">
|
|
||||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
|
||||||
<Operation>1</Operation>
|
|
||||||
<Extensions>.dylib</Extensions>
|
|
||||||
</Platform>
|
</Platform>
|
||||||
<Platform Name="iOSDevice32">
|
<Platform Name="iOSDevice32">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
<Extensions>.dylib</Extensions>
|
|
||||||
</Platform>
|
|
||||||
<Platform Name="iOSSimulator">
|
|
||||||
<Operation>1</Operation>
|
|
||||||
<Extensions>.dylib</Extensions>
|
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployClass>
|
</DeployClass>
|
||||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
[Stats]
|
[Stats]
|
||||||
EditorSecs=62163
|
EditorSecs=62883
|
||||||
DesignerSecs=6844
|
DesignerSecs=7804
|
||||||
InspectorSecs=2376
|
InspectorSecs=3050
|
||||||
CompileSecs=373514
|
CompileSecs=388395
|
||||||
OtherSecs=2081
|
OtherSecs=2182
|
||||||
StartTime=03/08/2018 07:57:26
|
StartTime=03/08/2018 07:57:26
|
||||||
RealKeys=0
|
RealKeys=0
|
||||||
EffectiveKeys=0
|
EffectiveKeys=0
|
||||||
DebugSecs=28213
|
DebugSecs=28776
|
||||||
|
|||||||
@ -7,6 +7,7 @@ inherited FormCidade: TFormCidade
|
|||||||
TextHeight = 18
|
TextHeight = 18
|
||||||
inherited ToolBar1: TToolBar
|
inherited ToolBar1: TToolBar
|
||||||
Width = 600
|
Width = 600
|
||||||
|
ExplicitWidth = 600
|
||||||
inherited btAnterior: TButton
|
inherited btAnterior: TButton
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
OnClick = btAnteriorClick
|
OnClick = btAnteriorClick
|
||||||
@ -33,42 +34,42 @@ inherited FormCidade: TFormCidade
|
|||||||
end
|
end
|
||||||
inherited Panel1: TPanel
|
inherited Panel1: TPanel
|
||||||
Width = 600
|
Width = 600
|
||||||
ExplicitHeight = 260
|
ExplicitWidth = 600
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
600
|
600
|
||||||
243)
|
243)
|
||||||
inherited Panel2: TPanel
|
inherited Panel2: TPanel
|
||||||
object Label1: TLabel [0]
|
object Label1: TLabel [0]
|
||||||
Left = 70
|
Left = 75
|
||||||
Top = 20
|
Top = 20
|
||||||
Width = 50
|
Width = 45
|
||||||
Height = 25
|
Height = 18
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Anchors = []
|
Anchors = []
|
||||||
Caption = 'C'#243'digo:'
|
Caption = 'C'#243'digo:'
|
||||||
end
|
end
|
||||||
object Label2: TLabel [1]
|
object Label2: TLabel [1]
|
||||||
Left = 70
|
Left = 75
|
||||||
Top = 70
|
Top = 70
|
||||||
Width = 50
|
Width = 45
|
||||||
Height = 25
|
Height = 18
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Anchors = []
|
Anchors = []
|
||||||
Caption = 'Cidade:'
|
Caption = 'Cidade:'
|
||||||
end
|
end
|
||||||
object Label3: TLabel [2]
|
object Label3: TLabel [2]
|
||||||
Left = 70
|
Left = 92
|
||||||
Top = 120
|
Top = 120
|
||||||
Width = 50
|
Width = 28
|
||||||
Height = 25
|
Height = 18
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Caption = 'Pa'#237's:'
|
Caption = 'Pa'#237's:'
|
||||||
end
|
end
|
||||||
object Label4: TLabel [3]
|
object Label4: TLabel [3]
|
||||||
Left = 300
|
Left = 330
|
||||||
Top = 120
|
Top = 120
|
||||||
Width = 50
|
Width = 20
|
||||||
Height = 25
|
Height = 18
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Anchors = []
|
Anchors = []
|
||||||
Caption = 'UF:'
|
Caption = 'UF:'
|
||||||
@ -126,6 +127,7 @@ inherited FormCidade: TFormCidade
|
|||||||
Text = 'Aguardando'
|
Text = 'Aguardando'
|
||||||
Width = 50
|
Width = 50
|
||||||
end>
|
end>
|
||||||
ExplicitTop = 293
|
ExplicitTop = 284
|
||||||
|
ExplicitWidth = 600
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -28,7 +28,6 @@ type
|
|||||||
procedure btExportarClick(Sender: TObject);
|
procedure btExportarClick(Sender: TObject);
|
||||||
procedure btImportarClick(Sender: TObject);
|
procedure btImportarClick(Sender: TObject);
|
||||||
procedure btContarClick(Sender: TObject);
|
procedure btContarClick(Sender: TObject);
|
||||||
procedure Button1Click(Sender: TObject);
|
|
||||||
procedure edCodExit(Sender: TObject);
|
procedure edCodExit(Sender: TObject);
|
||||||
procedure edFinalKeyPress(Sender: TObject; var Key: Char);
|
procedure edFinalKeyPress(Sender: TObject; var Key: Char);
|
||||||
procedure limpaCampos();
|
procedure limpaCampos();
|
||||||
@ -127,12 +126,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormCidade.Button1Click(Sender: TObject);
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
ShowMessage('teste');
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TFormCidade.cbLimparCamposClick(Sender: TObject);
|
procedure TFormCidade.cbLimparCamposClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
object FormGrid: TFormGrid
|
object FormGrid: TFormGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 448
|
Width = 350
|
||||||
Height = 418
|
Height = 350
|
||||||
AutoScroll = True
|
AutoScroll = True
|
||||||
Caption = 'FormGrid'
|
Caption = 'FormGrid'
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
@ -16,30 +16,36 @@ object FormGrid: TFormGrid
|
|||||||
Visible = True
|
Visible = True
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
|
OnKeyPress = FormKeyPress
|
||||||
PixelsPerInch = 96
|
PixelsPerInch = 96
|
||||||
TextHeight = 18
|
TextHeight = 18
|
||||||
object StringGrid1: TStringGrid
|
object StringGrid1: TStringGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 59
|
Top = 41
|
||||||
Width = 265
|
Width = 334
|
||||||
Height = 222
|
Height = 247
|
||||||
|
Align = alClient
|
||||||
ColCount = 4
|
ColCount = 4
|
||||||
DrawingStyle = gdsClassic
|
DrawingStyle = gdsClassic
|
||||||
FixedCols = 0
|
FixedCols = 0
|
||||||
FixedRows = 0
|
FixedRows = 0
|
||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected]
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnKeyPress = StringGrid1KeyPress
|
||||||
|
ExplicitTop = 36
|
||||||
|
ExplicitHeight = 251
|
||||||
end
|
end
|
||||||
object ToolBar1: TToolBar
|
object ToolBar1: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 432
|
Width = 334
|
||||||
Height = 29
|
Height = 41
|
||||||
ButtonHeight = 30
|
ButtonHeight = 30
|
||||||
Caption = 'ToolBar1'
|
Caption = 'ToolBar1'
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
ExplicitWidth = 384
|
||||||
object btExcluir: TButton
|
object btExcluir: TButton
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 0
|
Top = 0
|
||||||
@ -71,13 +77,21 @@ object FormGrid: TFormGrid
|
|||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
OnClick = btEscolherClick
|
OnClick = btEscolherClick
|
||||||
end
|
end
|
||||||
|
object edKeyPress: TEdit
|
||||||
|
Left = 150
|
||||||
|
Top = 0
|
||||||
|
Width = 111
|
||||||
|
Height = 30
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 2
|
||||||
|
TextHint = 'Pesquisa'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object edPesquisa: TEdit
|
object StatusBar1: TStatusBar
|
||||||
Left = 64
|
Left = 0
|
||||||
Top = 35
|
Top = 288
|
||||||
Width = 70
|
Width = 334
|
||||||
Height = 26
|
Height = 23
|
||||||
TabOrder = 2
|
Panels = <>
|
||||||
OnChange = edPesquisaChange
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
318
UnitFormGrid.pas
318
UnitFormGrid.pas
@ -13,16 +13,20 @@ type
|
|||||||
ToolBar1: TToolBar;
|
ToolBar1: TToolBar;
|
||||||
btExcluir: TButton;
|
btExcluir: TButton;
|
||||||
btEscolher: TButton;
|
btEscolher: TButton;
|
||||||
edPesquisa: TEdit;
|
edKeyPress: TEdit;
|
||||||
|
StatusBar1: TStatusBar;
|
||||||
procedure geraGrid(Lista: TLista; Classe: TClass);
|
procedure geraGrid(Lista: TLista; Classe: 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 FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormKeyPress(Sender: TObject; var Key: Char);
|
||||||
|
procedure StringGrid1KeyPress(Sender: TObject; var Key: Char);
|
||||||
|
procedure limpaGrid();
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
palavra: string;
|
palavra: string;
|
||||||
|
palavraPesquisa: string;
|
||||||
public
|
public
|
||||||
{ Public declarations }
|
{ Public declarations }
|
||||||
end;
|
end;
|
||||||
@ -37,6 +41,16 @@ implementation
|
|||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
uses UnitFormCidade;
|
uses UnitFormCidade;
|
||||||
|
|
||||||
|
procedure TFormGrid.limpaGrid;
|
||||||
|
var
|
||||||
|
linha: integer;
|
||||||
|
begin
|
||||||
|
for linha:= 1 to StringGrid1.RowCount -1 do
|
||||||
|
begin
|
||||||
|
StringGrid1.Rows[linha].Clear; //Cells[coluna,linha]:='';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFormGrid.btEscolherClick(Sender: TObject);
|
procedure TFormGrid.btEscolherClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
wObj: TObject;
|
wObj: TObject;
|
||||||
@ -69,142 +83,6 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFormGrid.edPesquisaChange(Sender: TObject);
|
|
||||||
var
|
|
||||||
wCont: integer;
|
|
||||||
wObj: TObject;
|
|
||||||
wLista: TLista;
|
|
||||||
linha: integer;
|
|
||||||
begin
|
|
||||||
palavra := edPesquisa.Text;
|
|
||||||
if palavra <> '' then
|
|
||||||
begin
|
|
||||||
wLista := TLista.Create;
|
|
||||||
for wCont := 0 to FLista.Count-1 do
|
|
||||||
begin
|
|
||||||
wObj := FLista.getObjectByIndex(wCont);
|
|
||||||
if wObj.ClassType = TCidade then
|
|
||||||
begin
|
|
||||||
with wObj as TCidade do
|
|
||||||
begin
|
|
||||||
if ContainsText(wCidade, palavra) then
|
|
||||||
begin
|
|
||||||
wLista.Inserir(wObj, TCidade);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if wObj.ClassType = TEstado then
|
|
||||||
begin
|
|
||||||
with wObj as TEstado do
|
|
||||||
begin
|
|
||||||
if ContainsText (wEstado, palavra) then
|
|
||||||
begin
|
|
||||||
wLista.Inserir(wObj, TEstado);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if wObj.ClassType = TPais then
|
|
||||||
begin
|
|
||||||
with wObj as TPais do
|
|
||||||
begin
|
|
||||||
if ContainsText (wPais, palavra) then
|
|
||||||
begin
|
|
||||||
wLista.Inserir(wObj, TPais);
|
|
||||||
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);
|
|
||||||
if wObj.ClassType = TCidade then
|
|
||||||
begin
|
|
||||||
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
|
|
||||||
else
|
|
||||||
if wObj.ClassType = TEstado then
|
|
||||||
begin
|
|
||||||
with wObj as TEstado do
|
|
||||||
begin
|
|
||||||
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
|
||||||
StringGrid1.Cells[1, wCont] := wEstado;
|
|
||||||
StringGrid1.Cells[2, wCont] := wPais;
|
|
||||||
StringGrid1.Cells[3, wCont] := inttostr(wAliquota);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if wObj.ClassType = TPais then
|
|
||||||
begin
|
|
||||||
with wObj as Tpais do
|
|
||||||
begin
|
|
||||||
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
|
||||||
StringGrid1.Cells[1, wCont] := wPais;
|
|
||||||
StringGrid1.Cells[2, wCont] := wNacionalidade;
|
|
||||||
StringGrid1.Cells[3, wCont] := inttostr(wCodfed);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
StringGrid1.RowCount := Flista.Count;
|
|
||||||
for wCont := 0 to FLista.Count-1 do
|
|
||||||
begin
|
|
||||||
wObj := FLista.getObjectByIndex(wCont);
|
|
||||||
if wObj.ClassType = TCidade then
|
|
||||||
begin
|
|
||||||
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
|
|
||||||
else
|
|
||||||
if wObj.ClassType = TEstado then
|
|
||||||
begin
|
|
||||||
with wObj as TEstado do
|
|
||||||
begin
|
|
||||||
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
|
||||||
StringGrid1.Cells[1, wCont] := wEstado;
|
|
||||||
StringGrid1.Cells[2, wCont] := wPais;
|
|
||||||
StringGrid1.Cells[3, wCont] := inttostr(wAliquota);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if wObj.ClassType = TPais then
|
|
||||||
begin
|
|
||||||
with wObj as TPais do
|
|
||||||
begin
|
|
||||||
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
|
||||||
StringGrid1.Cells[1, wCont] := wPais;
|
|
||||||
StringGrid1.Cells[2, wCont] := wNacionalidade;
|
|
||||||
StringGrid1.Cells[3, wCont] := inttostr(wCodFed);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TFormGrid.FormClose(Sender: TObject; var Action: TCloseAction);
|
procedure TFormGrid.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||||
begin
|
begin
|
||||||
Action := caFree;
|
Action := caFree;
|
||||||
@ -215,6 +93,13 @@ begin
|
|||||||
checkList := true;
|
checkList := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFormGrid.FormKeyPress(Sender: TObject; var Key: Char);
|
||||||
|
begin
|
||||||
|
edKeyPress.Text := Key;
|
||||||
|
ShowMessage(key);
|
||||||
|
ShowMessage('teste');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFormGrid.geraGrid(Lista: TLista; Classe: TClass);
|
procedure TFormGrid.geraGrid(Lista: TLista; Classe: TClass);
|
||||||
var
|
var
|
||||||
wCont: integer;
|
wCont: integer;
|
||||||
@ -238,24 +123,147 @@ begin
|
|||||||
StringGrid1.Cells[1, wCont] := wCidade;
|
StringGrid1.Cells[1, wCont] := wCidade;
|
||||||
StringGrid1.Cells[2, wCont] := wPais;
|
StringGrid1.Cells[2, wCont] := wPais;
|
||||||
StringGrid1.Cells[3, wCont] := wUF;
|
StringGrid1.Cells[3, wCont] := wUF;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if wObj.ClassType = TEstado then
|
||||||
|
with wObj as TEstado do
|
||||||
|
begin
|
||||||
|
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
||||||
|
StringGrid1.Cells[1, wCont] := wEstado;
|
||||||
|
StringGrid1.Cells[2, wCont] := wPais;
|
||||||
|
StringGrid1.Cells[3, wCont] := inttostr(wAliquota);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if wObj.ClassType = TPais then
|
||||||
|
with wObj as TPais do
|
||||||
|
begin
|
||||||
|
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
||||||
|
StringGrid1.Cells[1, wCont] := wPais;
|
||||||
|
StringGrid1.Cells[2, wCont] := wNacionalidade;
|
||||||
|
StringGrid1.Cells[3, wCont] := inttostr(wCodFed);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFormGrid.StringGrid1KeyPress(Sender: TObject; var Key: Char);
|
||||||
|
var
|
||||||
|
wObj: TObject;
|
||||||
|
wCol: integer;
|
||||||
|
wLista: TLista;
|
||||||
|
wCont: Integer;
|
||||||
|
begin
|
||||||
|
if ord(Key) = 8 then
|
||||||
|
begin
|
||||||
|
edKeyPress.Text := '';
|
||||||
|
limpaGrid();
|
||||||
|
StringGrid1.RowCount := FLista.Count;
|
||||||
|
for wCont := 0 to Flista.Count-1 do
|
||||||
|
begin
|
||||||
|
wObj := FLista.getObjectByIndex(wCont);
|
||||||
|
if wObj.ClassType = TCidade then
|
||||||
|
begin
|
||||||
|
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
|
||||||
|
else
|
||||||
|
if wObj.ClassType = TEstado then
|
||||||
|
begin
|
||||||
|
with wObj as TEstado do
|
||||||
|
begin
|
||||||
|
StringGrid1.Cells[0, wcont] := inttostr(wCod);
|
||||||
|
StringGrid1.Cells[1, wCont] := wEstado;
|
||||||
|
StringGrid1.Cells[2, wCont] := wPais;
|
||||||
|
StringGrid1.Cells[3, wCont] := inttostr(wAliquota);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if wObj.ClassType = TPais then
|
||||||
|
begin
|
||||||
|
with wObj as TPais do
|
||||||
|
begin
|
||||||
|
StringGrid1.Cells[0, wcont] := inttostr(wCod);
|
||||||
|
StringGrid1.Cells[1, wCont] := wPais;
|
||||||
|
StringGrid1.Cells[2, wCont] := wNacionalidade;
|
||||||
|
StringGrid1.Cells[3, wCont] := inttostr(wCodFed);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
edKeyPress.Text := edKeyPress.Text + key;
|
||||||
|
wCol :=StringGrid1.Col;
|
||||||
|
wLista := TLista.Create;
|
||||||
|
for wCont := 0 to FLista.Count-1 do
|
||||||
|
begin
|
||||||
|
wObj := FLista.getObjectByIndex(wCont);
|
||||||
|
if wObj.ClassType = TCidade then
|
||||||
|
begin
|
||||||
|
with wObj as TCidade do
|
||||||
|
if (wCol = 0) and (ContainsText (inttostr(wCod), edKeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TCidade)
|
||||||
|
else
|
||||||
|
if (wCol = 1) and (ContainsText (wCidade, edKeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TCidade)
|
||||||
|
else
|
||||||
|
if (wCol = 2) and (ContainsText (wPais, edKeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TCidade)
|
||||||
|
else
|
||||||
|
if (wCol = 3) and (ContainsText (wUF, edKeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TCidade);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if wObj.ClassType = TEstado then
|
||||||
|
begin
|
||||||
|
with wObj as TEstado do
|
||||||
|
if (wCol =0) and (ContainsText (inttostr(wCod), edKeypress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TEstado)
|
||||||
|
else
|
||||||
|
if (wCol =1) and (ContainsText(wEstado, edkeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TEstado)
|
||||||
|
else
|
||||||
|
if (wCol =2) and (ContainsText(wPais, edKeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TEstado)
|
||||||
|
else
|
||||||
|
if (wCol =3) and (ContainsText(inttostr(wAliquota), edKeyPress.Text)) then
|
||||||
|
wLista.Inserir(wObj, TEstado);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if wObj.ClassType = TPais then
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
if wLista.Count > 0 then
|
||||||
|
begin
|
||||||
|
limpaGrid();
|
||||||
|
StringGrid1.RowCount := wLista.Count;
|
||||||
|
for wCont := 0 to wLista.Count-1 do
|
||||||
|
begin
|
||||||
|
wObj := wLista.getObjectByIndex(wCont);
|
||||||
|
if wObj.ClassType = TCidade then
|
||||||
|
begin
|
||||||
|
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;
|
||||||
if wObj.ClassType = TEstado then
|
|
||||||
with wObj as TEstado do
|
end;
|
||||||
begin
|
|
||||||
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
|
||||||
StringGrid1.Cells[1, wCont] := wEstado;
|
|
||||||
StringGrid1.Cells[2, wCont] := wPais;
|
|
||||||
StringGrid1.Cells[3, wCont] := inttostr(wAliquota);
|
|
||||||
end;
|
|
||||||
if wObj.ClassType = TPais then
|
|
||||||
with wObj as TPais do
|
|
||||||
begin
|
|
||||||
StringGrid1.Cells[0, wCont] := inttostr(wCod);
|
|
||||||
StringGrid1.Cells[1, wCont] := wPais;
|
|
||||||
StringGrid1.Cells[2, wCont] := wNacionalidade;
|
|
||||||
StringGrid1.Cells[3, wCont] := inttostr(wCodFed);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user