unit uViewContacto; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uViewBase, ExtCtrls, StdCtrls, Buttons, DB, uDADataTable, DBCtrls, Grids, DBGrids, uBizContactos, Mask, ComCtrls, uCustomView, JvComponent, JvFormAutoSize, cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, dxLayoutControl, dxLayoutLookAndFeels, cxMemo, cxHyperLinkEdit, ImgList, ActnList, PngImageList, PngSpeedButton; type IViewContacto = interface(IViewBase) ['{5FCFD172-5F8A-4639-B479-1CF0061526B5}'] function GetContacto: IBizContacto; procedure SetContacto(const Value: IBizContacto); property Contacto: IBizContacto read GetContacto write SetContacto; end; TfrViewContacto = class(TfrViewBase, IViewContacto) dsContacto: TDADataSource; dxLayoutControlContactoGroup_Root: TdxLayoutGroup; dxLayoutControlContacto: TdxLayoutControl; dxLayoutControlContactoGroup1: TdxLayoutGroup; dxLayoutControlContactoGroup2: TdxLayoutGroup; dxLayoutControlContactoGroup3: TdxLayoutGroup; dxLayoutControlContactoGroup4: TdxLayoutGroup; dxLayoutControlContactoGroup5: TdxLayoutGroup; dxLayoutControlContactoGroup6: TdxLayoutGroup; dxLayoutControlContactoGroup7: TdxLayoutGroup; dxLayoutControlContactoGroup9: TdxLayoutGroup; dxLayoutControlContactoItem1: TdxLayoutItem; eCalle: TcxDBTextEdit; dxLayoutControlContactoItem2: TdxLayoutItem; eProvincia: TcxDBTextEdit; dxLayoutControlContactoItem3: TdxLayoutItem; ePoblacion: TcxDBTextEdit; dxLayoutControlContactoItem4: TdxLayoutItem; eCodigoPostal: TcxDBTextEdit; dxLayoutControlContactoGroup8: TdxLayoutGroup; eObservaciones: TcxDBMemo; dxLayoutControlContactoItem8: TdxLayoutItem; dxLayoutControlContactoItem9: TdxLayoutItem; eTlfParticular: TcxDBTextEdit; dxLayoutControlContactoItem10: TdxLayoutItem; eTlfTrabajo: TcxDBTextEdit; dxLayoutControlContactoItem11: TdxLayoutItem; eTlfMovil: TcxDBTextEdit; dxLayoutControlContactoItem12: TdxLayoutItem; eFax: TcxDBTextEdit; dxLayoutControlContactoItem13: TdxLayoutItem; eNombre: TcxDBTextEdit; dxLayoutControlContactoItem14: TdxLayoutItem; eNIFCIF: TcxDBTextEdit; dxLayoutControlContactoItem7: TdxLayoutItem; eMailTrabajo: TcxDBHyperLinkEdit; ActionList1: TActionList; actMandarCorreoParticular: TAction; actMandarCorreoTrabajo: TAction; actVerPaginaWeb: TAction; dxLayoutControlContactoItem6: TdxLayoutItem; eMailParticular: TcxDBHyperLinkEdit; dxLayoutControlContactoGroup110: TdxLayoutGroup; dxLayoutControlContactoItem5: TdxLayoutItem; ePaginaWeb: TcxDBHyperLinkEdit; ImageList1: TPngImageList; PngSpeedButton1: TPngSpeedButton; dxLayoutControlContactoItem15: TdxLayoutItem; PngSpeedButton2: TPngSpeedButton; dxLayoutControlContactoItem17: TdxLayoutItem; PngSpeedButton3: TPngSpeedButton; dxLayoutControlContactoItem18: TdxLayoutItem; dxLayoutControlContactoGroup12: TdxLayoutGroup; dxLayoutControlContactoGroup13: TdxLayoutGroup; dxLayoutControlContactoGroup11: TdxLayoutGroup; dxLayoutControlContactoItem25: TdxLayoutItem; eReferencia: TcxDBTextEdit; dxLayoutControlContactoGroup16: TdxLayoutGroup; procedure eMailTrabajoPropertiesEditValueChanged(Sender: TObject); procedure actMandarCorreoParticularExecute(Sender: TObject); procedure actMandarCorreoTrabajoExecute(Sender: TObject); procedure actVerPaginaWebExecute(Sender: TObject); procedure actMandarCorreoParticularUpdate(Sender: TObject); procedure actMandarCorreoTrabajoUpdate(Sender: TObject); procedure actVerPaginaWebUpdate(Sender: TObject); procedure eMailTrabajoPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); protected FContacto: IBizContacto; function GetContacto: IBizContacto; virtual; procedure SetContacto(const Value: IBizContacto); virtual; public constructor Create(AOwner : TComponent); override; property Contacto: IBizContacto read GetContacto write SetContacto; end; implementation {$R *.dfm} type THackcxDBHyperLinkEdit = class(TcxDBHyperLinkEdit); { TfrViewContactos } { ******************************* TfrViewContacto ******************************** } procedure TfrViewContacto.actMandarCorreoParticularExecute(Sender: TObject); begin inherited; THackcxDBHyperLinkEdit(eMailParticular).DoStart; end; procedure TfrViewContacto.actMandarCorreoParticularUpdate(Sender: TObject); begin inherited; (Sender as TAction).Enabled := (Length(eMailParticular.Text) > 0) end; procedure TfrViewContacto.actMandarCorreoTrabajoExecute(Sender: TObject); begin inherited; THackcxDBHyperLinkEdit(eMailTrabajo).DoStart; end; procedure TfrViewContacto.actMandarCorreoTrabajoUpdate(Sender: TObject); begin inherited; (Sender as TAction).Enabled := (Length(eMailTrabajo.Text) > 0) end; procedure TfrViewContacto.actVerPaginaWebExecute(Sender: TObject); begin inherited; THackcxDBHyperLinkEdit(ePaginaWeb).DoStart; end; procedure TfrViewContacto.actVerPaginaWebUpdate(Sender: TObject); begin inherited; (Sender as TAction).Enabled := (Length(ePaginaWeb.Text) > 0) end; constructor TfrViewContacto.Create(AOwner : TComponent); begin inherited; end; procedure TfrViewContacto.eMailTrabajoPropertiesEditValueChanged(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 TfrViewContacto.eMailTrabajoPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); begin inherited; if not VarIsNull(DisplayValue) then DisplayValue := StringReplace(DisplayValue, (Sender as TcxDBHyperLinkEdit).Properties.Prefix, '', []); end; function TfrViewContacto.GetContacto: IBizContacto; begin Result := FContacto; end; procedure TfrViewContacto.SetContacto(const Value: IBizContacto); begin FContacto := Value; if Assigned(FContacto) then begin dsContacto.DataTable := FContacto.DataTable; end else begin dsContacto.DataTable := NIL; end; end; initialization RegisterClass(TfrViewContacto); finalization UnRegisterClass(TfrViewContacto); end.