unit uViewProveedor;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewContacto, dxLayoutLookAndFeels, DB, uDADataTable,
  dxLayoutControl, cxMemo, cxDBEdit, cxContainer, cxEdit, cxTextEdit, cxControls,
  cxMaskEdit, cxSpinEdit, ImgList, PngImageList, ActnList, cxHyperLinkEdit,
  Buttons, PngSpeedButton, StdCtrls, cxCheckBox;

type
  IViewProveedor = interface(IViewContacto)
    ['{D251B289-767A-489A-A862-BE564C79EFE6}']
  end;

  TfrViewProveedor = class(TfrViewContacto, IViewProveedor)
    dxLayoutControlContactoGroup10: TdxLayoutGroup;
    dxLayoutControlContactoItem16: TdxLayoutItem;
    Label1: TLabel;
    dxLayoutControlContactoItem19: TdxLayoutItem;
    cxDBCheckBox1: TcxDBCheckBox;
    dxLayoutControlContactoItem20: TdxLayoutItem;
    Label2: TLabel;
    dxLayoutControlContactoItem21: TdxLayoutItem;
    eMailAdministracion: TcxDBHyperLinkEdit;
    dxLayoutControlContactoItem22: TdxLayoutItem;
    PngSpeedButton4: TPngSpeedButton;
    dxLayoutControlContactoGroup14: TdxLayoutGroup;
    dxLayoutControlContactoGroup15: TdxLayoutGroup;
    actMandarCorreoAdministrativo: TAction;
    procedure actMandarCorreoAdministrativoExecute(Sender: TObject);
    procedure actMandarCorreoAdministrativoUpdate(Sender: TObject);
    procedure eMailAdministracionPropertiesEditValueChanged(Sender: TObject);
    procedure eMailAdministracionPropertiesValidate(Sender: TObject;
      var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

{$R *.dfm}

type
  THackcxDBHyperLinkEdit = class(TcxDBHyperLinkEdit);

procedure TfrViewProveedor.actMandarCorreoAdministrativoExecute(
  Sender: TObject);
begin
  inherited;
  THackcxDBHyperLinkEdit(eMailTrabajo).DoStart;
end;

procedure TfrViewProveedor.actMandarCorreoAdministrativoUpdate(Sender: TObject);
begin
  inherited;
  (Sender as TAction).Enabled := (Length(eMailAdministracion.Text) > 0)
end;

procedure TfrViewProveedor.eMailAdministracionPropertiesEditValueChanged(
  Sender: TObject);
begin
  if not VarIsNull((Sender as TcxDBHyperLinkEdit).EditValue) then
     (Sender as TcxDBHyperLinkEdit).EditValue := StringReplace((Sender as TcxDBHyperLinkEdit).EditValue, (Sender as TcxDBHyperLinkEdit).Properties.Prefix, '', []);
end;

procedure TfrViewProveedor.eMailAdministracionPropertiesValidate(
  Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
  var Error: Boolean);
begin
  if not VarIsNull(DisplayValue) then
     DisplayValue := StringReplace(DisplayValue, (Sender as TcxDBHyperLinkEdit).Properties.Prefix, '', []);
end;

end.
