unit FDataVw;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, PdxForms,
  StdCtrls, Grids, DBGrids, ExtCtrls, DBCtrls, DB, DBTables;

type
  TF_DataView = class(TParadoxForm)
    Table1: TTable;
    DataSource1: TDataSource;
    DBNavigator1: TDBNavigator;
    DBGrid1: TDBGrid;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
    function getActive:Boolean;
    procedure setActive(newValue:Boolean);
    function getTableName: String;
    procedure setTableName( newValue: String);
  public
    { Public declarations }
  published
    Property Active :Boolean read getActive write setActive;
    Property TableName: String read getTableName write setTableName;
  end;

var
  F_DataView: TF_DataView;

implementation

Uses PdxAddIn;

{$R *.DFM}

function TF_DataView.getActive:Boolean;
Begin
  Result := Table1.Active;
end;

procedure TF_DataView.setActive(newValue:Boolean);
Begin
  Table1.Active := newValue;
end;

function TF_DataView.getTableName: String;
Begin
  Result := Table1.TableName;
end;

procedure TF_DataView.setTableName( newValue: String);
var wasActive:Boolean;
Begin
  if Table1.TableName = newValue then
    exit;
  wasActive := Table1.Active;
  Table1.Active := False;
  Table1.TableName := newValue;
  Table1.Active := wasActive;
end;

procedure TF_DataView.FormActivate(Sender: TObject);
//var
//  RegionSize:Integer;
begin
  if FormStyle <> fsMDIChild Then Exit;
{  RegionSize := 20;
  If Length(TableName) > RegionSize Then
    RegionSize := Length(TableName);
  Paradox.SetStatusRegions( [RegionSize] );
  Paradox.SetStatusText( 0, 'This is a Delphi Form' );
  Paradox.SetStatusText( 1, TableName ); }
end;

end.
