home *** CD-ROM | disk | FTP | other *** search
- unit ueditab;
-
- interface
-
- uses
- Wintypes, Winprocs, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- TeEngine, Series, TeeProcs, Chart, DBChart, ExtCtrls, DBCtrls, Grids,
- DBGrids, Db, DBTables, StdCtrls;
-
- { This example shows how to allow Table editing while the Chart
- refreshes new table contents, and the current record is preserved.
-
- By default, Series components connected to Tables
- ( Series1.DataSource := Table1 )
-
- refresh themselves when the Table is edited.
-
- But, the current record is not preserved.
- To keep the current record position, you should create a "BookMark",
- using the Table OnBeforeEdit event.
-
- Then, at Table OnAfterPost event you can use the bookmark to
- repositionate the current record.
-
- }
-
- type
- TEditTableForm = class(TForm)
- Table1: TTable;
- DataSource1: TDataSource;
- DBGrid1: TDBGrid;
- DBChart1: TDBChart;
- Series1: TBarSeries;
- Panel1: TPanel;
- DBNavigator1: TDBNavigator;
- Label1: TLabel;
- Panel2: TPanel;
- Label2: TLabel;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- procedure Table1AfterPost(DataSet: TDataset);
- procedure Table1BeforeEdit(DataSet: TDataset);
- private
- { Private declarations }
- public
- { Public declarations }
- bb:TBookMark;
- end;
-
- implementation
-
- {$R *.DFM}
-
- procedure TEditTableForm.Button1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TEditTableForm.Table1AfterPost(DataSet: TDataset);
- begin
- { go to current record... }
- Table1.GotoBookMark(bb);
- Table1.FreeBookMark(bb);
- end;
-
- procedure TEditTableForm.Table1BeforeEdit(DataSet: TDataset);
- begin
- { get current record... }
- bb:=Table1.GetBookMark;
- end;
-
- end.
-