home *** CD-ROM | disk | FTP | other *** search
- unit CustOrds;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Grids, DBGrids, StdCtrls, Mask, DBCtrls;
-
- type
- TfmCustOrd = class(TForm)
- DBEdit1: TDBEdit;
- DBGrid1: TDBGrid;
- procedure DBGrid1Enter(Sender: TObject);
- procedure DBEdit1Enter(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure FormActivate(Sender: TObject);
- end;
-
- var
- fmCustOrd: TfmCustOrd;
-
- implementation
-
- uses DM, Toolbar;
-
- {$R *.DFM}
-
- procedure TfmCustOrd.DBGrid1Enter(Sender: TObject);
- begin
- fmToolBar.SetNavigator(dm1.OrdersSource);
- end;
-
- procedure TfmCustOrd.DBEdit1Enter(Sender: TObject);
- begin
- fmToolBar.SetNavigator(dm1.CustomerSource);
- end;
-
- procedure TfmCustOrd.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- Action := caFree;
- end;
-
- procedure TfmCustOrd.FormActivate(Sender: TObject);
- begin
- { This procedure is necessary if to change the Datasource of the DBNavigator
- in the following conditions:
- 1. Focus was on Orders before the user moved to the CustView form, and the
- user has returned to this form by pressing Ctrl+F6, selecting it from the
- Window menu or clicking on the title bar.
- 2. Focus was on CustView, and the user clicked on the Orders Grid (dbGrid1).
- In both of the above cases, the OnEnter event of the grid doesn't execute,
- leaving the navigator pointing to CustomerSource. }
- if ActiveControl is TDBGrid then
- DBGrid1Enter(nil)
- end;
-
- end.