⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myip.pas

📁 MYSQL 连接控件 MYSQL 连接控件
💻 PAS
字号:
unit MyIP;

interface

uses
  SysUtils,WinTypes,WinProcs,Messages,Classes,Graphics,
  Controls,Forms,DB,dialogs,
  wwFilter,wwStr,wwSystem,wwTable,wwTypes,
  MySQLServer,MySQLDataset;

type

{ TwwMySQLQuery }

  TwwMySQLQuery = class (TMySQLQuery)
  private
    FControlType: TStrings;
    FPictureMasks: TStrings;
    FUsePictureMask: boolean;
    FOnInvalidValue: TwwInvalidValueEvent;

    function GetControlType: TStrings;
    procedure SetControlType(Sel: TStrings);
    function GetPictureMasks: TStrings;
    procedure SetPictureMasks(Sel: TStrings);

  protected
    procedure DoBeforePost; override;

  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

  published
    property ControlType: TStrings read GetControlType write SetControltype;
    property PictureMasks: TStrings read GetPictureMasks write SetPictureMasks;
    property ValidateWithMask: boolean read FUsePictureMask write FUsePictureMask;
    property OnInvalidValue: TwwInvalidValueEvent read FOnInvalidValue write FOnInvalidValue;
  end;

{ TwwMySQLTable }

  TwwMySQLTable = class (TMySQLTable)
  private
    FControlType: TStrings;
    FPictureMasks: TStrings;
    FUsePictureMask: boolean;
    FOnInvalidValue: TwwInvalidValueEvent;

    function GetControlType: TStrings;
    procedure SetControlType(Sel: TStrings);
    function GetPictureMasks: TStrings;
    procedure SetPictureMasks(Sel: TStrings);

  protected
    procedure DoBeforePost; override;

  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

  published
    property ControlType: TStrings read GetControlType write SetControltype;
    property PictureMasks: TStrings read GetPictureMasks write SetPictureMasks;
    property ValidateWithMask: boolean read FUsePictureMask write FUsePictureMask;
    property OnInvalidValue: TwwInvalidValueEvent read FOnInvalidValue write FOnInvalidValue;
  end;

procedure Register;

implementation
{$R MyIP.res}
uses
  wwCommon,dbConsts;

{ TwwMySQLQuery }

constructor TwwMySQLQuery.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);

  FControlType := TStringList.Create;
  FPictureMasks := TStringList.Create;
  FUsePictureMask := True;
end;

destructor TwwMySQLQuery.Destroy;
begin
  FControlType.Free;
  FPictureMasks.Free;
  FPictureMasks := nil;

  inherited Destroy;
end;

function TwwMySQLQuery.GetControlType: TStrings;
begin
  Result := FControlType;
end;

procedure TwwMySQLQuery.SetControlType(Sel: TStrings);
begin
  FControlType.Assign(Sel);
end;

function TwwMySQLQuery.GetPictureMasks: TStrings;
begin
  Result := FPictureMasks
end;

procedure TwwMySQLQuery.SetPictureMasks(Sel: TStrings);
begin
  FPictureMasks.Assign(Sel);
end;

procedure TwwMySQLQuery.DoBeforePost;
begin
  inherited DoBeforePost;

  if FUsePictureMask then
    wwValidatePictureFields(Self, FOnInvalidValue);
end;

{ TwwMySQLTable }

constructor TwwMySQLTable.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);

  FControlType := TStringList.Create;
  FPictureMasks := TStringList.Create;
  FUsePictureMask := True;
end;

destructor TwwMySQLTable.Destroy;
begin
  FControlType.Free;
  FPictureMasks.Free;
  FPictureMasks := nil;

  inherited Destroy;
end;

function TwwMySQLTable.GetControlType: TStrings;
begin
  Result := FControlType;
end;

procedure TwwMySQLTable.SetControlType(Sel: TStrings);
begin
  FControlType.Assign(Sel);
end;

function TwwMySQLTable.GetPictureMasks: TStrings;
begin
  Result := FPictureMasks
end;

procedure TwwMySQLTable.SetPictureMasks(Sel: TStrings);
begin
  FPictureMasks.Assign(Sel);
end;

procedure TwwMySQLTable.DoBeforePost;
begin
  inherited DoBeforePost;

  if FUsePictureMask then
    wwValidatePictureFields(Self, FOnInvalidValue);
end;

procedure Register;
begin
  RegisterComponents('MySQL', [TwwMySQLQuery]);
  RegisterComponents('MySQL', [TwwMySQLTable]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -