unit uEditorDireccion; interface uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls, DB, uDADataTable, PngSpeedButton, cxControls, cxContainer, cxEdit, cxTextEdit, cxHyperLinkEdit, cxDBEdit, uIEditorDireccionContacto, uDireccionesContactoController, uBizDireccionesContacto, cxCurrencyEdit, uDAInterfaces, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel, dxSkinCoffee, dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinSilver, dxSkinStardust, dxSkinsDefaultPainters, dxSkinValentine, dxSkinXmas2008Blue; type TfEditorDireccion = class(TForm, IEditorEditorDireccion) OKBtn: TButton; CancelBtn: TButton; Bevel1: TBevel; eDireccion: TDBEdit; ePoblacion: TDBEdit; eProvincia: TDBEdit; eCodigoPostal: TDBEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; dsDireccion: TDADataSource; Label5: TLabel; eNombre: TDBEdit; Label6: TLabel; ePersonaContacto: TDBEdit; Label7: TLabel; eTelefono: TDBEdit; eMail: TcxDBHyperLinkEdit; PngSpeedButton3: TPngSpeedButton; Label8: TLabel; Label9: TLabel; eNotas: TDBMemo; Label10: TLabel; ePortes: TcxDBCurrencyEdit; Label11: TLabel; eMovil: TDBEdit; Label12: TLabel; eFax: TDBEdit; procedure PngSpeedButton3Click(Sender: TObject); procedure eMailPropertiesEditValueChanged(Sender: TObject); procedure eMailPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); protected FController : IDireccionesContactoController; FDireccion: IBizDireccionesContacto; function GetController : IDireccionesContactoController; procedure SetController (const Value : IDireccionesContactoController); function GetDireccion: IBizDireccionesContacto; procedure SetDireccion(const Value: IBizDireccionesContacto); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; property Controller : IDireccionesContactoController read GetController write SetController; property Direccion: IBizDireccionesContacto read GetDireccion write SetDireccion; end; implementation uses Variants; {$R *.dfm} type THackcxDBHyperLinkEdit = class(TcxDBHyperLinkEdit); { TfEditorDireccion } constructor TfEditorDireccion.Create(AOwner: TComponent); begin inherited; FController := NIL; end; destructor TfEditorDireccion.Destroy; begin FController := NIL; inherited; end; procedure TfEditorDireccion.eMailPropertiesEditValueChanged(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 TfEditorDireccion.eMailPropertiesValidate(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; function TfEditorDireccion.GetController: IDireccionesContactoController; begin Result := FController; end; function TfEditorDireccion.GetDireccion: IBizDireccionesContacto; begin Result := FDireccion; end; procedure TfEditorDireccion.PngSpeedButton3Click(Sender: TObject); begin THackcxDBHyperLinkEdit(eMail).DoStart; end; procedure TfEditorDireccion.SetController( const Value: IDireccionesContactoController); begin FController := Value; end; procedure TfEditorDireccion.SetDireccion(const Value: IBizDireccionesContacto); begin FDireccion := Value; if Assigned(FDireccion) then dsDireccion.DataTable := FDireccion.DataTable else dsDireccion.DataTable := NIL; end; end.