Aquí el módulo que reúne las personas de contacto
Aquí la imagen
Aquí un detalle de datos de familia
Aquí el código
https://gist.github.com/anonymous/5693094
y por último las nuevas funciones usadas de mi fichero Fun.pas
Código Delphi
[-]function ImputFamiliaaMemo(Memo:TMemo;const ACaption, APrompt: string): string;
function GetCharSize(Canvas: TCanvas): TPoint;
var
I: Integer;
Buffer: array[0..51] of Char;
begin
for I := 0 to 25 do Buffer[i] := Chr(I + Ord('A'));
for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));
GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
Result.X := Result.X div 52;
end;
var
Form: TForm;
Prompt: TLabel;
Combo: TSpinEdit;
Ed: TEdit;
NomH:TEdit;
Labelfec2: TLabel;
labelnh:Tlabel;
DialogUnits: TPoint;
ButtonTop, ButtonWidth, ButtonHeight: Integer;
R: TRect;
begin
Result := '';
Form := TForm.Create(Application);
with Form do
try
Canvas.Font := Font;
DialogUnits := GetCharSize(Canvas);
BorderStyle := bsDialog;
FormStyle :=fsStayOnTop;
Caption := ACaption;
ClientWidth := MulDiv(195, DialogUnits.X, 4);
Position := poScreenCenter;
Prompt := TLabel.Create(Form);
with Prompt do
begin
Parent := Form;
Caption := APrompt;
Left := MulDiv(8, DialogUnits.X, 4);
Top := MulDiv(8, DialogUnits.Y, 8);
Constraints.MaxWidth := MulDiv(180, DialogUnits.X, 4);
WordWrap := True;
end;
Ed:=TEdit.Create(Form);
with Ed do
begin
Parent := Form;
Left := Prompt.Left;
Top := Prompt.top+Prompt.Height+5;
Width := MulDiv(180, DialogUnits.X, 4);
Text :='';
end;
Labelfec2 := TLabel.Create(Form);
with Labelfec2 do
begin
Parent := Form;
Caption := 'Número de hijos';
Left := Prompt.Left;
Top := ED.top+ED.Height+5;
WordWrap := True;
end;
Combo := TSpinEdit.Create(Form);
with Combo do
begin
Parent := Form;
Left := Prompt.Left;
Value :=0;
Top := Labelfec2.top+Labelfec2.Height+5;
Width := MulDiv(178, DialogUnits.X, 4);
end;
labelnh := TLabel.Create(Form);
with labelnh do
begin
Parent := Form;
Caption := 'Nombre de los hijos';
Left := Prompt.Left;
Top := Combo.top+Combo.Height+5;
WordWrap := True;
end;
NomH := TEdit.Create(Form);
with NomH do
begin
Parent := Form;
Left := Prompt.Left;
Top := labelnh.top+labelnh.Height+5;
Width := MulDiv(180, DialogUnits.X, 4);
Text :='';
end;
ButtonTop := NomH.top+NomH.Height+10;;
ButtonWidth := MulDiv(50, DialogUnits.X, 4);
ButtonHeight := MulDiv(14, DialogUnits.Y, 8);
with TButton.Create(Form) do
begin
Parent := Form;
Caption := 'OK';
ModalResult := mrOk;
default := True;
SetBounds(MulDiv(Prompt.Left-2, DialogUnits.X, 4), ButtonTop, ButtonWidth,
ButtonHeight);
end;
with TButton.Create(Form) do
begin
Parent := Form;
Caption := 'Cancelar';
ModalResult := mrCancel;
Cancel := True;
SetBounds(MulDiv(137, DialogUnits.X, 4), ButtonTop,ButtonWidth, ButtonHeight);
Form.ClientHeight :=ButtonTop+ButtonHeight+5; end;
if ShowModal = mrOk then
begin
if Ed.Text<>'' then Memo.Lines.Add('Esposa:[ '+ed.Text+' ]');
if Combo.Value<>0 then
begin
Memo.Lines.Add('Nº de hijos:[ '+IntToStr(Combo.Value)+' ]');
if NomH.Text<>'' then Memo.Lines.Add('Nombre de los hijos:[ '+NomH.Text+' ]');
end;
end;
finally
Form.Free;
end;
end;
function FECHA_DBEDIT_ENTER(dbedit:tdbedit;Fecha:String=VMiautoFecha):Tdate;
begin
try
try
if dbedit.Text<>'' then dbedit.Text:=Fecha
else begin
Fecha:=DateToStr(now);
dbedit.Text:=fecha;
end;
StrToDate(fecha); except
on E: Exception do
begin
ShowMessage('Se ha producido un error: ' + Chr(13) + Chr(13)
+ 'Clase de error: ' + E.ClassName + Chr(13) + Chr(13)
+ 'Mensaje del error: ' + E.Message+Chr(13) + Chr(13)
+ ' '+Chr(13) + Chr(13)
+ 'Se anula la Fecha introducida y se asigna la del sistema');
dbedit.Text:=DateToStr(Now);
Fecha:=DateToStr(now);
end;
end;
finally
Result:=StrToDate(Fecha);
end;
end;
function FECHA_DBEDIT(dbedit:tdbedit; Tecla:Word):Boolean;
begin
if (Tecla=VK_UP) then DBEdit.text:=DateToStr(StrToDate(DBEdit.Text)+1); if (Tecla=VK_DOWN) then DBEdit.Text:=DateToStr(StrToDate(DBEdit.Text)-1);end;