FIBDBLoginDlg.pas
上传用户:whawj2006
上传日期:2016-08-08
资源大小:572k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. {***************************************************************}
  2. { FIBPlus - component library for direct access to Firebird and }
  3. { InterBase databases                                           }
  4. {                                                               }
  5. {    FIBPlus is based in part on the product                    }
  6. {    Free IB Components, written by Gregory H. Deatz for        }
  7. {    Hoagland, Longo, Moran, Dunst & Doukas Company.            }
  8. {    mailto:gdeatz@hlmdd.com                                    }
  9. {                                                               }
  10. {    Copyright (c) 1998-2007 Devrace Ltd.                       }
  11. {    Written by Serge Buzadzhy (buzz@devrace.com)               }
  12. {                                                               }
  13. { ------------------------------------------------------------- }
  14. {    FIBPlus home page: http://www.fibplus.com/                 }
  15. {    FIBPlus support  : http://www.devrace.com/support/         }
  16. { ------------------------------------------------------------- }
  17. {                                                               }
  18. {  Please see the file License.txt for full license information }
  19. {***************************************************************}
  20. unit FIBDBLoginDlg;
  21. interface
  22. {$I FIBPlus.inc}
  23. uses
  24.  {$IFDEF WINDOWS}
  25.   Windows, Messages, SysUtils, Classes,  Controls, Forms, Dialogs,
  26.   StdCtrls, ExtCtrls;
  27.  {$ENDIF}
  28.  {$IFDEF LINUX}
  29.   SysUtils, Types, Classes, QControls, QForms, QDialogs,QExtCtrls,
  30.   QStdCtrls;
  31.  {$ENDIF}
  32. type
  33.   TfrmFIBDBLoginDlg = class(TForm)
  34.     Bevel1: TBevel;
  35.     Label1: TLabel;
  36.     lbDBName: TLabel;
  37.     Bevel2: TBevel;
  38.     Button1: TButton;
  39.     Button2: TButton;
  40.     Label2: TLabel;
  41.     Label3: TLabel;
  42.     Label4: TLabel;
  43.     EdUserName: TEdit;
  44.     EdPassword: TEdit;
  45.     EdRole: TEdit;
  46.     procedure FormCreate(Sender: TObject);
  47.   private
  48.     { Private declarations }
  49.   public
  50.     { Public declarations }
  51.   end;
  52.  function pFIBLoginDialogEx(const ADatabaseName: string; var AUserName, APassword,ARoleName: string): Boolean;
  53. implementation
  54. {$R *.dfm}
  55. uses fib, FIBConsts;
  56.  function pFIBLoginDialogEx(const ADatabaseName: string;
  57.    var AUserName, APassword,ARoleName: string
  58.  ): Boolean;
  59.   var  frmFIBDBLoginDlg: TfrmFIBDBLoginDlg;
  60.  begin
  61.   frmFIBDBLoginDlg:= TfrmFIBDBLoginDlg.Create(nil);
  62.   with frmFIBDBLoginDlg do
  63.   try
  64.    if Length(ADatabaseName)<=45 then
  65.     lbDBName.Caption:= ADatabaseName
  66.    else
  67.     lbDBName.Caption:=Copy(ADatabaseName,1,10)+'...'+
  68.       Copy(ADatabaseName,Length(ADatabaseName)-32,MaxInt);
  69.    EdUserName.Text      := AUserName;
  70.    EdRole    .Text      := ARoleName;
  71.    Result:= ShowModal=mrOk;
  72.    if Result then
  73.    begin
  74.      AUserName  := EdUserName.Text;
  75.      ARoleName  := EdRole    .Text;
  76.      APassword  := EdPassword.Text;
  77.    end;  
  78.   finally
  79.    Free;
  80.   end
  81.  end;
  82.  
  83. procedure TfrmFIBDBLoginDlg.FormCreate(Sender: TObject);
  84. begin
  85.   Caption := SLoginDlgLoginCaption;
  86.   Label1.Caption := SLoginDlgDatabase;
  87.   Label2.Caption := SDBEditUserName;
  88.   Label3.Caption := SDBEditPassword;
  89.   Label4.Caption := SDBEditSQLRole;
  90.   Button1.Caption := SOKButton;
  91.   Button2.Caption := SCancelButton;
  92. end;
  93. initialization
  94.  pFIBLoginDialog  :=pFIBLoginDialogEx;
  95. finalization
  96.  pFIBLoginDialog  :=nil
  97. end.