Skip to content

Commit

Permalink
Alterações no Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
bittencourtthulio committed Mar 18, 2021
1 parent ed87be1 commit 67e15db
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Sample/Project1.dproj.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2021/03/10 18:00:54.000.682,D:\Projetos\Componentes\BindFormJson\Unit2.dfm=C:\Users\thuli\Documents\Embarcadero\Studio\Projects\Unit2.dfm</Transaction>
<Transaction>2021/03/10 18:00:56.000.814,D:\Projetos\Componentes\BindFormJson\Project1.dproj=C:\Users\thuli\Documents\Embarcadero\Studio\Projects\Project1.dproj</Transaction>
<Transaction>2021/03/10 18:00:54.000.682,C:\Users\thuli\Documents\Embarcadero\Studio\Projects\Unit2.dfm=D:\Projetos\Componentes\BindFormJson\Unit2.dfm</Transaction>
<Transaction>2021/03/10 18:00:56.000.814,C:\Users\thuli\Documents\Embarcadero\Studio\Projects\Project1.dproj=D:\Projetos\Componentes\BindFormJson\Project1.dproj</Transaction>
</Transactions>
</BorlandProject>
Binary file modified Sample/Project1.identcache
Binary file not shown.
5 changes: 3 additions & 2 deletions Sample/Unit2.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object Form2: TForm2
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Edit1: TEdit
Expand Down Expand Up @@ -45,7 +46,7 @@ object Form2: TForm2
Width = 186
Height = 21
TabOrder = 3
Text = 'Edit2'
Text = '22996857484'
end
object ComboBox1: TComboBox
Left = 24
Expand Down Expand Up @@ -94,7 +95,7 @@ object Form2: TForm2
Width = 186
Height = 21
TabOrder = 8
Text = 'ID'
Text = '5456445-654654'
end
object Button2: TButton
Left = 543
Expand Down
35 changes: 30 additions & 5 deletions Sample/Unit2.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, BindFormJson,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Bind4D,
Vcl.ComCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client;
Expand All @@ -13,37 +13,57 @@ interface
TForm2 = class(TForm)

[FieldJsonBind('Nome'), FbIgnoreDelete]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
Edit1: TEdit;

[FieldJsonBind('Telefone'), FbIgnoreDelete]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI', teCell)]
Edit2: TEdit;

[FieldJsonBind('Sexo'), FbIgnoreDelete]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
ComboBox1: TComboBox;

[FieldJsonBind('Status'), FbIgnoreDelete]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
CheckBox1: TCheckBox;

[FieldJsonBind('Tipo'), FbIgnoreDelete]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
RadioGroup1: TRadioGroup;

[FieldJsonBind('Data'), FbIgnoreDelete]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
DateTimePicker1: TDateTimePicker;

[FieldJsonBind('Id'), FbIgnorePost]
[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
[fvNotNull('Campo ID não pode ser nulo')]
edtId: TEdit;

[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
Button2: TButton;

[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
Button3: TButton;

[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
Button4: TButton;

[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
Memo1: TMemo;

[ComponentBindStyle(clWindow, 8, $00322f2d, 'Segoe UI')]
Button1: TButton;


FDMemTable1: TFDMemTable;

procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
Expand All @@ -66,7 +86,7 @@ procedure TForm2.Button1Click(Sender: TObject);
aJson : TJsonObject;
begin
Memo1.Lines.Clear;
aJson := TBindFormJson.New.FormToJson(Self, fbGet);
aJson := TBind4D.New.Form(Self).FormToJson(fbGet);
try
Memo1.Lines.Add(aJson.ToString);
finally
Expand All @@ -79,7 +99,7 @@ procedure TForm2.Button2Click(Sender: TObject);
aJson : TJsonObject;
begin
Memo1.Lines.Clear;
aJson := TBindFormJson.New.FormToJson(Self, fbPost);
aJson := TBind4D.New.Form(Self).FormToJson(fbPost);
try
Memo1.Lines.Add(aJson.ToString);
finally
Expand All @@ -92,7 +112,7 @@ procedure TForm2.Button3Click(Sender: TObject);
aJson : TJsonObject;
begin
Memo1.Lines.Clear;
aJson := TBindFormJson.New.FormToJson(Self, fbPut);
aJson := TBind4D.New.Form(Self).FormToJson(fbPut);
try
Memo1.Lines.Add(aJson.ToString);
finally
Expand All @@ -105,12 +125,17 @@ procedure TForm2.Button4Click(Sender: TObject);
aJson : TJsonObject;
begin
Memo1.Lines.Clear;
aJson := TBindFormJson.New.FormToJson(Self, fbDelete);
aJson := TBind4D.New.Form(Self).FormToJson(fbDelete);
try
Memo1.Lines.Add(aJson.ToString);
finally
aJson.Free;
end;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
TBind4D.New.Form(Self).SetStyleComponents;
end;

end.

0 comments on commit 67e15db

Please sign in to comment.