unit uViewInternet;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewBase, DB, uDADataTable, StdCtrls, Mask, DBCtrls, ExtCtrls,
  JvComponent, JvFormAutoSize, dxLayoutControl, cxControls, cxContainer,
  cxEdit, cxTextEdit, cxDBEdit, cxHyperLinkEdit, Buttons, ActnList, ImgList;

type
  TfrViewInternet = class(TfrViewBase)
    DADataSource: TDADataSource;
    dxLayoutControl1: TdxLayoutControl;
    dxLayoutGroup1: TdxLayoutGroup;
    dxLayoutGroup2: TdxLayoutGroup;
    eMailTrabajo: TcxDBHyperLinkEdit;
    dxLayoutControl1Item5: TdxLayoutItem;
    ePaginaWeb: TcxDBHyperLinkEdit;
    dxLayoutControl1Item2: TdxLayoutItem;
    dxLayoutControl1Item3: TdxLayoutItem;
    eMailParticular: TcxDBHyperLinkEdit;
    dxLayoutControl1Item1: TdxLayoutItem;
    SpeedButton1: TSpeedButton;
    dxLayoutControl1Group1: TdxLayoutGroup;
    ActionList1: TActionList;
    actMandarCorreoParticular: TAction;
    actMandarCorreoTrabajo: TAction;
    ImageList1: TImageList;
    dxLayoutControl1Item4: TdxLayoutItem;
    SpeedButton2: TSpeedButton;
    dxLayoutControl1Group2: TdxLayoutGroup;
    dxLayoutControl1Item6: TdxLayoutItem;
    SpeedButton3: TSpeedButton;
    dxLayoutControl1Group3: TdxLayoutGroup;
    actVerPaginaWeb: TAction;
    procedure eMailPropertiesEditValueChanged(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure actMandarCorreoParticularUpdate(Sender: TObject);
    procedure actMandarCorreoTrabajoUpdate(Sender: TObject);
    procedure actMandarCorreoParticularExecute(Sender: TObject);
    procedure actMandarCorreoTrabajoExecute(Sender: TObject);
    procedure actVerPaginaWebExecute(Sender: TObject);
    procedure actVerPaginaWebUpdate(Sender: TObject);
  end;


implementation

uses StrUtils;

{$R *.dfm}

type
  THackcxDBHyperLinkEdit = class(TcxDBHyperLinkEdit);

procedure TfrViewInternet.eMailPropertiesEditValueChanged(Sender: TObject);
begin
  inherited;
  if not varisnull((Sender as TcxDBHyperLinkEdit).EditValue) then
     (Sender as TcxDBHyperLinkEdit).EditValue := StringReplace((Sender as TcxDBHyperLinkEdit).EditValue, (Sender as TcxDBHyperLinkEdit).Properties.Prefix, '', []);
end;

procedure TfrViewInternet.SpeedButton1Click(Sender: TObject);
begin
  inherited;
  THackcxDBHyperLinkEdit(eMailParticular).DoStart;
end;

procedure TfrViewInternet.actMandarCorreoParticularUpdate(Sender: TObject);
begin
  inherited;
  (Sender as TAction).Enabled := (Length(eMailParticular.Text) > 0)
end;

procedure TfrViewInternet.actMandarCorreoTrabajoUpdate(Sender: TObject);
begin
  inherited;
  (Sender as TAction).Enabled := (Length(eMailTrabajo.Text) > 0)
end;

procedure TfrViewInternet.actMandarCorreoParticularExecute(
  Sender: TObject);
begin
  inherited;
  THackcxDBHyperLinkEdit(eMailParticular).DoStart;
end;

procedure TfrViewInternet.actMandarCorreoTrabajoExecute(Sender: TObject);
begin
  inherited;
  THackcxDBHyperLinkEdit(eMailTrabajo).DoStart;
end;

procedure TfrViewInternet.actVerPaginaWebExecute(Sender: TObject);
begin
  inherited;
  THackcxDBHyperLinkEdit(ePaginaWeb).DoStart;
end;

procedure TfrViewInternet.actVerPaginaWebUpdate(Sender: TObject);
begin
  inherited;
  (Sender as TAction).Enabled := (Length(ePaginaWeb.Text) > 0)
end;

initialization
  RegisterClass(TfrViewInternet);

finalization

  UnRegisterClass(TfrViewInternet);

end.

