【delphi开源代码栏目提醒】:网学会员在delphi开源代码频道为大家收集整理了Frmviews.pas提供大家参考,希望对大家有所帮助!
unit Frmviews;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, Forms, DBCtrls, DB, DBGrids, Buttons, DBTables, Grids, ExtCtrls;
type
TFrmViewDemo = class(TForm)
DBGrid1: TDBGrid;
DBNavigator: TDBNavigator;
Panel1: TPanel;
VaryingTableSource: TDataSource;
Panel2: TPanel;
VaryingTable: TTable;
BitBtn1: TBitBtn;
BtnShowEmployee: TSpeedButton;
BtnShowPhoneList: TSpeedButton;
procedure BtnShowEmployeeClick(Sender: TObject);
procedure BtnShowPhoneListClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ private declarations }
procedure ShowTable(ATable: string);
public
{ public declarations }
end;
var
FrmViewDemo: TFrmViewDemo;
implementation
{$R *.dfm}
procedure TFrmViewDemo.ShowTable( ATable: string );
begin
Screen.Cursor := crHourglass; { show user something's happening }
VaryingTable.DisableControls; { hide data changes from user }
VaryingTable.Active := FALSE; { close the table }
VaryingTable.TableName := ATable; { update the name }
VaryingTable.Open; { open the table }
VaryingTable.EnableControls; { paint the changes }
Screen.Cursor := crDefault; { reset the pointer }
end;
procedure TFrmViewDemo.FormShow(Sender: TObject);
begin
VaryingTable.Open;
end;
procedure TFrmViewDemo.BtnShowEmployeeClick(Sender: TObject);
begin
ShowTable('EMPLOYEE');
end;
procedure TFrmViewDemo.BtnShowPhoneListClick(Sender: TObject);
begin
ShowTable('PHONE_LIST');
end;
end.