• R/O
  • SSH
  • HTTPS

brutaldelphi: Commit


Commit MetaInfo

Révision5 (tree)
l'heure2022-01-08 11:05:30
Auteurderekwildstar

Message de Log

Exemplo básico de utilização do TBRDMasterNavigator concluído

Change Summary

Modification

--- trunk/dmo/prj/BrutalDelphi.dpr (revision 4)
+++ trunk/dmo/prj/BrutalDelphi.dpr (revision 5)
@@ -2,7 +2,8 @@
22
33 uses
44 Vcl.Forms,
5- UFormPrincipal in '..\src\UFormPrincipal.pas' {Form1};
5+ UFormPrincipal in '..\src\UFormPrincipal.pas' {FormPrincipal},
6+ UDamoPrincipal in '..\src\UDamoPrincipal.pas' {DamoPrincipal: TDataModule};
67
78 {$R *.res}
89
@@ -9,6 +10,6 @@
910 begin
1011 Application.Initialize;
1112 Application.MainFormOnTaskbar := True;
12- Application.CreateForm(TForm1, Form1);
13+ Application.CreateForm(TFormPrincipal, FormPrincipal);
1314 Application.Run;
1415 end.
--- trunk/dmo/prj/BrutalDelphi.dproj (revision 4)
+++ trunk/dmo/prj/BrutalDelphi.dproj (revision 5)
@@ -68,6 +68,7 @@
6868 <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
6969 <VerInfo_Locale>1033</VerInfo_Locale>
7070 <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
71+ <Icon_MainIcon>..\res\bdd.ico</Icon_MainIcon>
7172 </PropertyGroup>
7273 <PropertyGroup Condition="'$(Base_Win64)'!=''">
7374 <DCC_UsePackage>DBXSqliteDriver;bindcompdbx;RESTComponents;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;IndyIPCommon;vclFireDAC;IndySystem;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;TeeDB;FireDAC;vcltouch;vcldb;bindcompfmx;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;inetdb;CEF4Delphi;FMXTee;soaprtl;DbxCommonDriver;FmxTeeUI;ibxpress;FireDACIBDriver;fmx;fmxdae;xmlrtl;soapmidas;ibxbindings;fmxobj;vclwinx;vclib;rtl;Tee;DbxClientDriver;GR32_R;CustomIPTransport;vcldsnap;dbexpress;IndyCore;vclx;bindcomp;appanalytics;dsnap;officeXPrt;FireDACCommon;IndyIPClient;bindcompvcl;RESTBackendComponents;TeeUI;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;PNGComponentsR;FireDACConnR;ADOConnR;UserControlR;vclie;bindengine;DBXMySQLDriver;CloudService;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;IndyProtocols;DBXConnR;FireDACCommonODBC;FireDACCommonDriver;inet;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
@@ -104,9 +105,14 @@
104105 <MainSource>MainSource</MainSource>
105106 </DelphiCompile>
106107 <DCCReference Include="..\src\UFormPrincipal.pas">
107- <Form>Form1</Form>
108+ <Form>FormPrincipal</Form>
108109 <FormType>dfm</FormType>
109110 </DCCReference>
111+ <DCCReference Include="..\src\UDamoPrincipal.pas">
112+ <Form>DamoPrincipal</Form>
113+ <FormType>dfm</FormType>
114+ <DesignClass>TDataModule</DesignClass>
115+ </DCCReference>
110116 <BuildConfiguration Include="Release">
111117 <Key>Cfg_2</Key>
112118 <CfgParent>Base</CfgParent>
@@ -129,7 +135,7 @@
129135 </Source>
130136 </Delphi.Personality>
131137 <Deployment Version="3">
132- <DeployFile LocalName="Win32\Debug\BrutalDelphi.exe" Configuration="Debug" Class="ProjectOutput">
138+ <DeployFile LocalName="..\bin\BrutalDelphi.exe" Configuration="Debug" Class="ProjectOutput">
133139 <Platform Name="Win32">
134140 <RemoteName>BrutalDelphi.exe</RemoteName>
135141 <Overwrite>true</Overwrite>
--- trunk/dmo/src/UDamoPrincipal.pas (nonexistent)
+++ trunk/dmo/src/UDamoPrincipal.pas (revision 5)
@@ -0,0 +1,58 @@
1+unit UDamoPrincipal;
2+
3+interface
4+
5+uses
6+ System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option,
7+ FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
8+ FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.VCLUI.Wait,
9+ Data.DB, FireDAC.Comp.Client, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
10+ FireDAC.Stan.ExprFuncs, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf,
11+ FireDAC.DApt, FireDAC.Comp.DataSet, BRD.MasterNavigator;
12+
13+type
14+ TDamoPrincipal = class(TDataModule)
15+ FDCO: TFDConnection;
16+ FDTACustomers: TFDTable;
17+ FDTACustomersCustomerID: TStringField;
18+ FDTACustomersCompanyName: TStringField;
19+ FDTACustomersContactName: TStringField;
20+ FDTACustomersContactTitle: TStringField;
21+ FDTACustomersAddress: TStringField;
22+ FDTACustomersCity: TStringField;
23+ FDTACustomersRegion: TStringField;
24+ FDTACustomersPostalCode: TStringField;
25+ FDTACustomersCountry: TStringField;
26+ FDTACustomersPhone: TStringField;
27+ FDTACustomersFax: TStringField;
28+ DASOCustomers: TDataSource;
29+ BRDMasterNavigator: TBRDMasterNavigator;
30+ procedure DataModuleCreate(Sender: TObject);
31+ procedure DataModuleDestroy(Sender: TObject);
32+ private
33+ { Private declarations }
34+ public
35+ { Public declarations }
36+ end;
37+
38+implementation
39+
40+{%CLASSGROUP 'Vcl.Controls.TControl'}
41+
42+uses UFormPrincipal;
43+
44+{$R *.dfm}
45+
46+procedure TDamoPrincipal.DataModuleCreate(Sender: TObject);
47+begin
48+ FDCO.Params.Database := ExtractFilePath(ParamStr(0)) + 'fddemo.sdb';
49+ FDCO.Open;
50+ FDTACustomers.Open;
51+end;
52+
53+procedure TDamoPrincipal.DataModuleDestroy(Sender: TObject);
54+begin
55+ FDCO.Close;
56+end;
57+
58+end.
--- trunk/dmo/src/UFormPrincipal.pas (revision 4)
+++ trunk/dmo/src/UFormPrincipal.pas (revision 5)
@@ -4,21 +4,38 @@
44
55 uses
66 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
7- Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
7+ Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons,
8+ BRD.MasterNavigator, UDamoPrincipal, Data.DB, Vcl.Grids, Vcl.DBGrids;
89
910 type
10- TForm1 = class(TForm)
11+ TFormPrincipal = class(TForm)
12+ BBTNCancelar: TBitBtn;
13+ BBTNGravar: TBitBtn;
14+ BBTNExcluir: TBitBtn;
15+ BBTNNovo: TBitBtn;
16+ DBGRCustomers: TDBGrid;
17+ BBTNEditar: TBitBtn;
1118 private
1219 { Private declarations }
20+ FDamoPrincipal: TDamoPrincipal;
1321 public
1422 { Public declarations }
23+ constructor Create(AOwner: TComponent); override;
1524 end;
1625
1726 var
18- Form1: TForm1;
27+ FormPrincipal: TFormPrincipal;
1928
2029 implementation
2130
2231 {$R *.dfm}
2332
33+{ TFormPrincipal }
34+
35+constructor TFormPrincipal.Create(AOwner: TComponent);
36+begin
37+ inherited;
38+ FDamoPrincipal := TDamoPrincipal.Create(Self);
39+end;
40+
2441 end.
--- trunk/src/BRD.MasterNavigator.pas (revision 4)
+++ trunk/src/BRD.MasterNavigator.pas (revision 5)
@@ -32,9 +32,9 @@
3232 FEventoCancelar: TNotifyEvent;
3333 FEventoGravar: TNotifyEvent;
3434 FEventoExcluir: TNotifyEvent;
35- FSN_Excluir: Boolean;
36- FSN_Editar: Boolean;
37- FSN_Incluir: Boolean;
35+ FPodeExcluir: Boolean;
36+ FPodeEditar: Boolean;
37+ FPodeIncluir: Boolean;
3838 FFocusComp: TWinControl;
3939 FMensagemErro: TGetStrProc;
4040 FConfirmacao: TMsgPergunta;
@@ -45,9 +45,9 @@
4545 procedure setBtnExcluir(const AValue: TCustomButton);
4646 procedure setBtnGravar(const AValue: TCustomButton);
4747 procedure setBtnNovo(const AValue: TCustomButton);
48- procedure SetSN_Editar(const AValue: Boolean);
49- procedure SetSN_Excluir(const AValue: Boolean);
50- procedure SetSN_Incluir(const AValue: Boolean);
48+ procedure SetPodeEditar(const AValue: Boolean);
49+ procedure SetPodeExcluir(const AValue: Boolean);
50+ procedure SetPodeIncluir(const AValue: Boolean);
5151 procedure UpdateGUI;
5252
5353 procedure AcaoNovo(ASender: TObject);
@@ -71,9 +71,9 @@
7171 property BtnCancelar: TCustomButton read FBtnCancelar write SetBtnCancelar;
7272 property BtnGravar: TCustomButton read FBtnGravar write setBtnGravar;
7373 property BtnExcluir: TCustomButton read FBtnExcluir write setBtnExcluir;
74- property SN_Excluir: Boolean read FSN_Excluir write SetSN_Excluir default True;
75- property SN_Editar: Boolean read FSN_Editar write SetSN_Editar default True;
76- property SN_Incluir: Boolean read FSN_Incluir write SetSN_Incluir default True;
74+ property PodeExcluir: Boolean read FPodeExcluir write SetPodeExcluir default True;
75+ property PodeEditar: Boolean read FPodeEditar write SetPodeEditar default True;
76+ property PodeIncluir: Boolean read FPodeIncluir write SetPodeIncluir default True;
7777 property DataSource: TDataSource read GetDataSource write SetDataSource;
7878 property FocusComp: TWinControl read FFocusComp write FFocusComp;
7979 property OnError: TGetStrProc read FMensagemErro write FMensagemErro;
@@ -102,8 +102,8 @@
102102
103103 FLink.DataSet.Edit;
104104
105- if Assigned(FocusComp) then
106- TrySetFocus(FocusComp);
105+ if Assigned(FFocusComp) then
106+ TrySetFocus(FFocusComp);
107107 end;
108108
109109 procedure TBRDMasterNavigator.AcaoExcluir(ASender: TObject);
@@ -155,8 +155,8 @@
155155
156156 FLink.DataSet.Append;
157157
158- if Assigned(FocusComp) then
159- TrySetFocus(FocusComp);
158+ if Assigned(FFocusComp) then
159+ TrySetFocus(FFocusComp);
160160 end;
161161
162162 constructor TBRDMasterNavigator.Create(AOwner: TComponent);
@@ -166,9 +166,9 @@
166166 FLink := TChangeDataLink.Create;
167167 FLink.StateChange := DoStateChange;
168168
169- FSN_Excluir := True;
170- FSN_Editar := True;
171- FSN_Incluir := True;
169+ FPodeExcluir := True;
170+ FPodeEditar := True;
171+ FPodeIncluir := True;
172172 FFocusComp := nil;
173173 FBtnNovo := nil;
174174 FBtnEditar := nil;
@@ -224,12 +224,12 @@
224224 SetEnabled(FBtnCancelar,EditInsert);
225225
226226 if not EditInsert then
227- SetEnabled(FBtnEditar,(not FLink.DataSet.IsEmpty) and SN_Editar)
227+ SetEnabled(FBtnEditar,(not FLink.DataSet.IsEmpty) and PodeEditar)
228228 else
229229 SetEnabled(FBtnEditar,False);
230230
231- SetEnabled(FBtnNovo,not EditInsert and SN_Incluir);
232- SetEnabled(FBtnExcluir,not EditInsert and SN_Excluir);
231+ SetEnabled(FBtnNovo,not EditInsert and PodeIncluir);
232+ SetEnabled(FBtnExcluir,not EditInsert and PodeExcluir);
233233 end
234234 else
235235 begin
@@ -507,21 +507,21 @@
507507 FLink.DataSource := AValue;
508508 end;
509509
510-procedure TBRDMasterNavigator.SetSN_Editar(const AValue: Boolean);
510+procedure TBRDMasterNavigator.SetPodeEditar(const AValue: Boolean);
511511 begin
512- FSN_Editar := AValue;
512+ FPodeEditar := AValue;
513513 UpdateGUI;
514514 end;
515515
516-procedure TBRDMasterNavigator.SetSN_Excluir(const AValue: Boolean);
516+procedure TBRDMasterNavigator.SetPodeExcluir(const AValue: Boolean);
517517 begin
518- FSN_Excluir := AValue;
518+ FPodeExcluir := AValue;
519519 UpdateGUI;
520520 end;
521521
522-procedure TBRDMasterNavigator.SetSN_Incluir(const AValue: Boolean);
522+procedure TBRDMasterNavigator.SetPodeIncluir(const AValue: Boolean);
523523 begin
524- FSN_Incluir := AValue;
524+ FPodeIncluir := AValue;
525525 UpdateGUI;
526526 end;
527527
Afficher sur ancien navigateur de dépôt.