home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / Runimage / Delphi50 / Demos / Midas / Brfcase / clntfrm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  2.1 KB  |  79 lines

  1. unit ClntFrm;
  2.  
  3. {
  4.   This is the client side of the Briefcase demo.  The Connected checkbox shows
  5.   if the server is connected or not.  Notice that the FileName property of the
  6.   ClientDataSet is set.  This causes the ClientDataSet to load from the file
  7.   when it is opened and save to the file when it is closed.  It also has the
  8.   ProviderName property set.  This allows it to ApplyUpdates and retrieve data
  9.   if the file does not exist.
  10. }
  11.  
  12. interface
  13.  
  14. uses
  15.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  16.   DBClient, MConnect, StdCtrls, Db, Grids, DBGrids, ActnList, ExtCtrls;
  17.  
  18. type
  19.   TForm1 = class(TForm)
  20.     DCOMConnection1: TDCOMConnection;
  21.     ClientDataSet1: TClientDataSet;
  22.     DBGrid1: TDBGrid;
  23.     DataSource1: TDataSource;
  24.     Button1: TButton;
  25.     CheckBox1: TCheckBox;
  26.     ActionList1: TActionList;
  27.     Action1: TAction;
  28.     Action2: TAction;
  29.     procedure Action1Update(Sender: TObject);
  30.     procedure Action2Execute(Sender: TObject);
  31.     procedure Action2Update(Sender: TObject);
  32.     procedure ClientDataSet1ReconcileError(DataSet: TClientDataSet;
  33.       E: EReconcileError; UpdateKind: TUpdateKind;
  34.       var Action: TReconcileAction);
  35.     procedure Action1Execute(Sender: TObject);
  36.   private
  37.     { Private declarations }
  38.   public
  39.     { Public declarations }
  40.   end;
  41.  
  42. var
  43.   Form1: TForm1;
  44.  
  45. implementation
  46.  
  47. uses RecError;
  48.  
  49. {$R *.DFM}
  50.  
  51. procedure TForm1.Action1Update(Sender: TObject);
  52. begin
  53.   Action1.Checked := DCOMConnection1.Connected;
  54. end;
  55.  
  56. procedure TForm1.Action1Execute(Sender: TObject);
  57. begin
  58.   DCOMConnection1.Connected := not Action1.Checked;
  59. end;
  60.  
  61. procedure TForm1.Action2Update(Sender: TObject);
  62. begin
  63.   Action2.Enabled := ClientDataSet1.ChangeCount > 0;
  64. end;
  65.  
  66. procedure TForm1.Action2Execute(Sender: TObject);
  67. begin
  68.   ClientDataSet1.ApplyUpdates(-1);
  69. end;
  70.  
  71. procedure TForm1.ClientDataSet1ReconcileError(DataSet: TClientDataSet;
  72.   E: EReconcileError; UpdateKind: TUpdateKind;
  73.   var Action: TReconcileAction);
  74. begin
  75.   Action := HandleReconcileError(DataSet, UpdateKind, E);
  76. end;
  77.  
  78. end.
  79.