home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk15 / dbtools.pak / OPENDB.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-08-24  |  1.4 KB  |  60 lines

  1. {
  2.   See the README.TXT for instructions on installing the demo db components
  3.   from the BDETable into COMPLIB.DCL.  These components are required for
  4.   properly viewing or building the demo applications in this directory.
  5. }
  6.  
  7. unit Opendb;
  8.  
  9. interface
  10.  
  11. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  12.   StdCtrls, ExtCtrls, Db, Grids, DBGrids, BDETable, DBTables;
  13.  
  14. type
  15.   TOpenDbDlg = class(TForm)
  16.     OKBtn: TBitBtn;
  17.     CancelBtn: TBitBtn;
  18.     AliasList: TDatabaseList;
  19.     AliasSource: TDataSource;
  20.     AliasGrid: TDBGrid;
  21.     AliasListNAME: TStringField;
  22.     AliasListPHYNAME: TStringField;
  23.     AliasListDBTYPE: TStringField;
  24.     procedure FormShow(Sender: TObject);
  25.     procedure FormHide(Sender: TObject);
  26.     procedure OKBtnClick(Sender: TObject);
  27.   private
  28.     { Private declarations }
  29.   public
  30.     AliasName: TSymbolStr;
  31.     AliasType: TSymbolStr;
  32.   end;
  33.  
  34. var
  35.   OpenDbDlg: TOpenDbDlg;
  36.  
  37. implementation
  38.  
  39. {$R *.DFM}
  40.  
  41. procedure TOpenDbDlg.FormShow(Sender: TObject);
  42. begin
  43.   AliasList.Active := True;
  44.   OKBtn.Enabled := AliasList.RecordCount > 0;
  45. end;
  46.  
  47. procedure TOpenDbDlg.FormHide(Sender: TObject);
  48. begin
  49.   AliasList.Active := False
  50. end;
  51.  
  52. procedure TOpenDbDlg.OKBtnClick(Sender: TObject);
  53. begin
  54.   AliasName := AliasListNAME.Value;
  55.   AliasType := AliasListDBTYPE.Value;
  56.   ModalResult := mrOK;
  57. end;
  58.  
  59. end.
  60.