Buenos días compañeros, solicito vuestra ayuda, ya que llevo varios días trabajndo en este componente para el programa, que estoy realizando actualmente y tengo los siguientes errores que no logro resolver, los problemas son los siguientes
El Reloj, no cambia y la alarma no salta
y al salir del programa da estos errores, se que el segundo es derivado del primero, o eso creo
Os pongo una imagen con el componente en diversas configuraciones
El Error
Y el segundo error
Ahora os pongo el código 1ª parte
[DELPHI]unit UPanelDiary;
interface
uses WinTypes, WinProcs, Messages, SysUtils, Classes, Controls,
Forms, Graphics, Extctrls, StdCtrls, Dialogs;
type
TClockSelected=(Select12,Select24);
TLengua=(Espanol, Frances, Aleman, Italiano, Ingles, Catalan, Gallego, Vasco);
TFormato=(Basico,Extendido,Completo);
//Para el Panel Reloj
TClock=class(TPersistent) //Para crear propiedades agrupadas
private
FClock12_24 : TClockSelected;
FClockEnable : Boolean;
FPanelVisible : Boolean;
FColorClock : TColor;
FFontClock : TFont;
FInterval : Integer;
FAlarmActive : Boolean;
FHourAlarm : TTime;
FHour : TTime;
FMessageAlarm : String;
procedure SetClock12_24(Value : TClockSelected);
procedure SetClockEnable(Value : Boolean);
procedure SetPAnelVisible(Value : Boolean);
procedure SetColorClock(Value : TColor);
procedure SetFontClock(Value : TFont);
procedure SetInterval(Value : Integer);
procedure SetAlarmActive(Value : Boolean);
procedure SetHourAlarm(Value:TTime);
procedure SetMessageAlarm(Value:string);
protected
published
property Clock12_24 : TClockSelected read FClock12_24 write SetClock12_24 default Select12; { Ver el Reloj en 12 o 24 horas }
property ClockEnable : Boolean read FClockEnable write SetClockEnable default True; { Reloj en uso }
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
property ColorClock : TColor read FColorClock write SetColorClock default $00FFCCCC; { Color de Fondo Del Reloj }
property FontClock : TFont read FFontClock write SetFontClock; { Fuente del Reloj }
property Interval : Integer read FInterval write SetInterval default 1000; { Intervalo para el Disparador }
property AlarmActive:Boolean read FAlarmActive write SetAlarmActive default False; { Si hay una alarma activa }
property HourAlarm: TTime read FHourAlarm write SetHourAlarm; { Hora a la que disparar la alarma }
property MessageAlarm:string read FMessageAlarm write SetMessageAlarm; { Mensaje a mostrar al disparar la alarma }
end;
type
TDayX=class(TPersistent) //Para crear propiedades agrupadas
private //Este siempre esta visible
FColorDay : TColor; //Color del panel
FFontDay : TFont;
FHeight : Integer;
procedure SetColorDay(Value : TColor);
procedure SetFontDay(Value : TFont);
procedure SetHeight(Value:Integer);
published
property ColorDay : TColor read FColorDay write SetColorDay default clWhite; { Color de fondo del Dia }
property FontDay : TFont read FFontDay write SetFontDay; { Fuente del dia }
property Height :integer read FHeight write SetHeight;
end;
type
TMonth=class(TPersistent) //Para crear propiedades agrupadas
private
FColorMonth : TColor;
FFontMonth : TFont;
FPanelVisible : Boolean;
procedure SetColorMonth(Value : TColor);
procedure SetFontMonth(Value : TFont);
procedure SetPAnelVisible(Value : Boolean);
published
property ColorMonth : TColor read FColorMonth write SetColorMonth default $0033CCFF; { Color de Fondo Del MEs }
property FontMonth : TFont read FFontMonth write SetFontMonth; { Fuente del mes }
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
end;
type
TYear=class(TPersistent) //Para crear propiedades agrupadas
private
FColorYear : TColor;
FFontYear : TFont;
FPanelVisible : Boolean;
procedure SetColorYear(Value : TColor);
procedure SetFontYear(Value : TFont);
procedure SetPAnelVisible(Value : Boolean);
published
property ColorYear : TColor read FColorYear write SetColorYear default $0033CCFF; { Color de Fondo Del año }
property FontYear : TFont read FFontYear write SetFontYear; { Fuente del Año }
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
end;
type
TStation=class(TPersistent) //Para crear propiedades agrupadas
private
FColorStation : TColor;
FFontStation : TFont;
FPanelVisible : Boolean;
procedure SetColorStation(Value : TColor);
procedure SetFontStation(Value : TFont);
procedure SetPAnelVisible(Value : Boolean);
published
property ColorStation : TColor read FColorStation write SetColorStation default clRed; { Color de Fondo de la Estacion }
property FontStation : TFont read FFontStation write SetFontStation; { Fuente de la Estacion }
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
end;
type
TWeeksDay=class(TPersistent) //Para crear propiedades agrupadas
private
FColorWeeksDays : TColor;
FFontWeekDays : TFont;
FPanelVisible : Boolean;
procedure SetColorWeeksDays(Value : TColor);
procedure SetFontWeekDays(Value : TFont);
procedure SetPAnelVisible(Value : Boolean);
published
property ColorWeeksDays : TColor read FColorWeeksDays write SetColorWeeksDays default $0033CCFF; { Color de fondo }
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
property FontWeekDays : TFont read FFontWeekDays write SetFontWeekDays; { Muestra las semanasy dias transcurridos/pendientes fuentes}
end;
type
TDayExt=class(TPersistent) //Para crear propiedades agrupadas
private
FColorDayExt : TColor;
FFontDayExt : TFont;
FPanelVisible : Boolean;
procedure SetColorDayExt(Value : TColor);
procedure SetFontDayExt(Value : TFont);
procedure SetPAnelVisible(Value : Boolean);
published
property ColorDayExt : TColor read FColorDayExt write SetColorDayExt default $0033CCFF; { Color de Fondo Del Dia Extendido }
property FontDayExt : TFont read FFontDayExt write SetFontDayExt; { Fuente del dia extendido }
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
end;
type
TNotice=class(TPersistent) //Para crear propiedades agrupadas
private
FPanelVisible : Boolean;
FNoticeColor : TColor;
FNoticeFont : TFont;
FText1 : string;
FText2 : string;
FHeight : Integer;
procedure SetNoticeColor(Value : TColor);
procedure SetNoticeFont(Value : TFont);
procedure SetPAnelVisible(Value : Boolean);
procedure SetText1(Value:string);
procedure SetText2(Value:string);
procedure SetHeight(Value : Integer);
published
property PanelVisible : Boolean read FPanelVisible write SetPAnelVisible default True; { Ver Eel panel }
property NoticeColor : TColor read FNoticeColor write SetNoticeColor default clBlue;
property NoticeFont : TFont read FNoticeFont write SetNoticeFont;
property Text1 :string read FText1 write SetText1;
property Text2 :string read FText2 write SetText2;
property Height :Integer read FHeight write SetHeight;
end;
type
TMiPanelDiary = class(TPanel)
private
{ Private fields of TPanelDiary }
FTipo : TFormato;
FDay : TDayX; //Dia siempre visible
FDayExt : TDayExt; //Muestra más información del día
FMonth : TMonth; //Muestra el mes
FYear : TYear; //Muestra el año
FWeeksDays : TWeeksDay; //Muestra información adicional
FStation : TStation; //Muestra cual de las 4 estaciones estamos
FClock : TClock; //Muestra el reloj y la alarma
FNotice : TNotice; //Muestra 2 lineas con información
FDate : TDate; //Fecha
FDay_mmddyy : String; //Formato de la fecha
FLanguage : TLengua; //Lenguaje a mostrar los texto por defecto
FOnlyOneFont : Boolean; //Una fuente para todos, exepto el día
FUsarComentarios : Boolean; //Mostrar Comentarios y datos
FAutoheight : Boolean; //Cuadra la altura de los diversos paneles
FMyTimer : TTimer;
FPanelNotice : TPanel;
FPanelStation : Tpanel;
FPanelDayExt : Tpanel;
FPanelDayX : TPanel;
FPanelMonth : TPanel;
FPanelYear : TPanel;
FPanelWeeksDay : TPanel;
FPanelClock : TPanel;
FTexto1 : TLabel;
FTexto2 : TLabel;
FOnClickNotice : TNotifyEvent; { Al pulsar en el panel de avisos }
FOnClickClock : TNotifyEvent; { Al pulsar en el Reloj }
FOnClickDay : TNotifyEvent; { Al pulsar en el dia }
FOnClickDayExt : TNotifyEvent; { Al pulsar en el dia Extendido }
FOnClickMonth : TNotifyEvent; { Al pulsar en el mes }
FOnClickStation : TNotifyEvent; { Al pulsar en el Estacion }
FOnClickWeeksDays : TNotifyEvent; { Al pulsar en el Semanas/dias }
FOnClickYEar : TNotifyEvent; { Al pulsar en el año }
FOnDateChanged : TNotifyEvent; { Cuando cambia de Dia }
FOnAlarm : TNotifyEvent; {Cuando salta la alarma }
FOnTimer : TNotifyEvent; { cuando hace timer }
procedure AutoInitialize;
procedure AutoDestroy;
procedure SetDate(Value : TDate);
procedure SetLanguage(Value : TLengua);
procedure SetUsarComentarios(Value : Boolean);
procedure SetTipo(Value : TFormato);
procedure SetAutoheight(Value : Boolean);
procedure SetOnlyOneFont(Value : Boolean);
protected
procedure ClickNotice(Sender : TObject); virtual; { Al pulsar en el panel de avisos }
procedure ClickClock(Sender : TObject); virtual; { Al pulsar en el Reloj }
procedure ClickDay(Sender : TObject); virtual; { Al pulsar en el dia }
procedure ClickDayExt(Sender : TObject); virtual; { Al pulsar en el dia Extendido }
procedure ClickMonth(Sender : TObject); virtual; { Al pulsar en el mes }
procedure ClickStation(Sender : TObject); virtual; { Al pulsar en el Estacion }
procedure ClickWeeksDays(Sender : TObject); virtual; { Al pulsar en el Semanas/dias }
procedure ClickYEar(Sender : TObject); virtual; { Al pulsar en el año }
procedure Alarm(Sender : TObject); virtual; { Al dar la alarma }
procedure DateChanged(Sender : TObject); virtual; { Cuando cambia de Dia }
procedure Timer(Sender:TObject); virtual; { cuando hace timer }
procedure Click; override;
procedure Loaded; override;
procedure Paint; override;
procedure Resize; override;
public
property Day_mmddyy : String read FDay_mmddyy; { Muestra el dia para consultas SQL }
procedure Calculos; { Calculamnos la estacion del año semanas y dias }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property OnClickNotice : TNotifyEvent read FOnClickNotice write FOnClickNotice;
property OnClickClock : TNotifyEvent read FOnClickClock write FOnClickClock;
property OnClickDay : TNotifyEvent read FOnClickDay write FOnClickDay;
property OnClickDayExt : TNotifyEvent read FOnClickDayExt write FOnClickDayExt;
property OnClickMonth : TNotifyEvent read FOnClickMonth write FOnClickMonth;
property OnClickStation : TNotifyEvent read FOnClickStation write FOnClickStation;
property OnClickWeeksDays : TNotifyEvent read FOnClickWeeksDays write FOnClickWeeksDays;
property OnClickYEar : TNotifyEvent read FOnClickYEar write FOnClickYEar;
property OnDateChanged : TNotifyEvent read FOnDateChanged write FOnDateChanged;
property OnAlarm : TNotifyEvent read FOnAlarm write FOnAlarm;
property OnTimer : TNotifyEvent read FOnDateChanged write FOnDateChanged;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property Date : TDate read FDate write SetDate; { Dia para los Calculos }
property Language : TLengua read FLanguage write SetLanguage default Espanol; { Lenguaje Seleccionado }
property OnlyOneFont : Boolean read FOnlyOneFont write SetOnlyOneFont default False; { Usar solo una fuente }
property Notice:TNotice read FNotice write FNotice;
property Station:TStation read FStation write FStation;
property DayExt:TDayExt read FDayExt write FDayExt;
property Day: TDayX read FDay write FDay;
property Month:TMonth read FMonth write FMonth;
property Year:Tyear read FYear write FYear;
property WeekDays:TWeeksDay read FWeeksDays write FWeeksDays;
property Clock:TClock read FClock write FClock;
property UsarComentarios:Boolean read FUsarComentarios write SetUsarComentarios ;
property Tipo: TFormato read FTipo write SetTipo;
property Autoheight:Boolean read FAutoheight write SetAutoheight ;
end;
[/DELPHI]
Solicito ayuda para resolver los problemas de este nuevo componente
Comenzado por
Desart
, ago 27 2013 03:53
7 respuestas en este tema
#1
Escrito 27 agosto 2013 - 03:53
#2
Escrito 27 agosto 2013 - 03:55
2ª parte del código
[DELPHI]
var VarIHeighAutoHEigt:Integer;
implementation
{ TPanelDiary }
procedure TMiPanelDiary.Alarm(Sender: TObject);
begin
if Assigned(FOnAlarm) then FOnAlarm(Sender);
if FClock.FMessageAlarm<>'' then ShowMessage(FClock.FMessageAlarm);
end;
procedure TMiPanelDiary.AutoDestroy;
begin
FClock.Free;
FClock.FFontClock.Free;
FDay.FFontDay.Free;
FDayExt.FFontDayExt.Free;
FMonth.FFontMonth.Free;
FStation.FFontStation.Free;
FWeeksDays.FFontWeekDays.Free;
FYear.FFontYear.Free;
FPanelNotice.Free;
FPanelStation.Free;
FPanelDayExt.Free;
FPanelDayX.Free;
FPanelMonth.Free;
FPanelYear.Free;
FPanelWeeksDay.Free;
FPanelClock.Free;
FMyTimer.free;
FTexto1.Free;
FTexto2.Free;
end;
procedure TMiPanelDiary.AutoInitialize;
begin
FOnlyOneFont := False;
FDate := Now;
FLanguage := Espanol;
Height := 318;
Width := 177;
FUsarComentarios := True;
Ftipo := Completo;
FAutoheight := False;
//------------------------------------------------Notice
FNotice := TNotice.Create;
Fnotice.FNoticeColor := clBlue;
FNotice.FPanelVisible := False;
FNotice.FText1 := '';
FNotice.FText2 := '';
FNotice.Height := 40;
FNotice.FNoticeFont := TFont.Create;
with FNotice.FNoticeFont do
begin
Color := clYellow;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Estacion
FStation := TStation.Create;
FStation.FColorStation := $0033CCFF;
FStation.FPanelVisible := True;
FStation.FFontStation := TFont.Create;
with FStation.FFontStation do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FStation.FColorStation := clRed;
//------------------------------------------------Dias Extendidos
FDayExt := TDayExt.Create;
FDayExt.FColorDayExt := $0033CCFF;
FDayExt.FPanelVisible := True;
FDayExt.FFontDayExt := TFont.Create;
with FDayExt.FFontDayExt do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Dia
FDay := TDayX.Create;
FDay.FColorDay := clWhite;
FDay.FHeight := 100;
FDay.FFontDay := TFont.Create;
with FDay.FFontDay do
begin
Color := clBlack;
Name := 'Arial';
Size := 70;
Style := [fsBold]
end;
//------------------------------------------------Mes
FMonth := TMonth.Create;
FMonth.FColorMonth := $0033CCFF;
FMonth.FPanelVisible := True;
FMonth.FFontMonth := TFont.Create;
with FMonth.FFontMonth do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Año
FYear := TYear.Create;
FYear.FColorYear := $0033CCFF;
FYear.FPanelVisible := True;
FYear.FFontYear := TFont.Create;
with FYear.FFontYear do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Semanas dias
FWeeksDays := TWeeksDay.Create;
FWeeksDays.FColorWeeksDays := $0033CCFF;
FWeeksDays.FPanelVisible := True;
FWeeksDays.FFontWeekDays := TFont.Create;
with FWeeksDays.FFontWeekDays do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//-------------------------------------------------CLOCK
FClock := TClock.Create;
FClock.FClockEnable := True;
FClock.FPanelVisible := True;
FClock.FFontClock := TFont.Create;
FClock.FClock12_24 := Select12;
FClock.FColorClock := $00FFCCCC;
FClock.FFontClock.color := $00003333;
FClock.FInterval := 1000;
FClock.FAlarmActive := False;
FClock.FHourAlarm := Now;
FClock.FMessageAlarm := '';
FClock.FHour := Now;
FMyTimer:=TTimer.Create(Self); //-------------------------------------------------Timer
with FMyTimer do
begin
Enabled := FClock.FClockEnable;
Interval := FClock.FInterval;
OnTimer := FOnTimer;
end;
FPanelNotice:=TPanel.Create(Self); //------------------------------------------------Notice
with FPanelNotice do
begin
Parent := Self;
TabOrder := 0;
Align := alTop;
Visible := False;
Font := FNotice.FNoticeFont;
Color := FNotice.FNoticeColor;
Visible := FNotice.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Height := FNotice.Height;
Caption :='';
end;
FTexto1:=TLabel.Create(Self);
with FTexto1 do
begin
Parent := FPanelNotice;
Top := 3;
Left := 3;
AutoSize := False;
Width := FPanelNotice.Width-6;
Font := FNotice.FNoticeFont;
Transparent:= True;
Alignment := taCenter
end;
FTexto2:=TLabel.Create(Self);
with FTexto2 do
begin
Parent := FPanelNotice;
Top := 3+FNotice.FNoticeFont.Size+1; //?? +/-
Left := 3;
AutoSize := False;
Width := FPanelNotice.Width;
Font := FNotice.FNoticeFont;
Transparent:= True;
Alignment := taCenter
end;
FPanelDayExt:=TPanel.Create(Self); //------------------------------------------------Dia Extendido
with FPanelDayExt do
begin
Parent := Self;
TabOrder := 1;
Align := alTop;
Font := FDayExt.FontDayExt;
Color := FDayExt.FColorDayExt;
Visible := FDayExt.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :=' Dia ';
end;
FPaneldayx:=TPanel.Create(Self); //------------------------------------------------Dia
with FPanelDayX do
begin
Parent := Self;
TabOrder := 2;
Align := alTop;
Font := FDay.FFontDay;
Color := FDay.FColorDay;
Caption := FormatDateTime('dd',Date);
ParentColor := false;
ParentBackground :=False;
Height := FDay.FHeight;
end;
FPanelMonth:=TPanel.Create(Self); //------------------------------------------------Mes
with FPanelMonth do
begin
Parent := Self;
TabOrder := 3;
Align := alTop;
Font := FMonth.FFontMonth;
Color := FMonth.FColorMonth;
Visible := FMonth.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :='MES';
end;
FPanelYear:=TPanel.Create(Self); //------------------------------------------------Año
with FPanelYear do
begin
Parent := Self;
TabOrder := 4;
Align := alTop;
Font := FYear.FFontYear;
Color := FYear.FColorYear;
Visible := FYear.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :=' AÑO ';
end;
FPanelWeeksDay:=TPanel.Create(Self); //------------------------------------------------Semanas Dias
with FPanelWeeksDay do
begin
Parent := Self;
TabOrder := 5;
Align := alTop;
Font := FWeeksDays.FFontWeekDays;
Color := FWeeksDays.FColorWeeksDays;
Visible := FWeeksDays.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Height := 30;
Caption :='Semanas Dias';
end;
FPanelStation:=TPanel.Create(Self); //------------------------------------------------Station
with FPanelStation do
begin
Parent := Self;
TabOrder := 6;
Align := alTop;
Visible := FStation.FPanelVisible;
Font := FStation.FFontStation;
Color := FStation.FColorStation;
ParentColor :=false;
ParentBackground :=False;
Height := 30;
Caption :=' ESTACION ';
end;
FPanelClock:=TPanel.Create(Self); //------------------------------------------------Reloj
with FPanelClock do
begin
Parent := Self;
TabOrder := 7;
Align := alTop;
Font := FClock.FFontClock;
Color := FClock.FColorClock;
Visible := FClock.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Visible := True;
Height := 30;
Caption :='Reloj';
end;
end;
procedure TMiPanelDiary.Calculos;
var VariNumeroPaneles:Integer;
begin { Calculamnos la estacion del año semanas y dias }
VariNumeroPaneles:=1;
if FNotice.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FDayExt.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FMonth.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FYear.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FWeeksDays.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FStation.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FClock.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
VarIHeighAutoHEigt:=(Self.Height-FDay.FHeight) div (VariNumeroPaneles-1);
end;
procedure TMiPanelDiary.Click;
begin
inherited Click;
end;
procedure TMiPanelDiary.ClickClock(Sender: TObject);
begin
if Assigned(FOnClickClock) then FOnClickClock(Sender);
end;
procedure TMiPanelDiary.ClickDay(Sender: TObject);
begin
if Assigned(FOnClickDay) then FOnClickDay(Sender);
end;
procedure TMiPanelDiary.ClickDayExt(Sender: TObject);
begin
if Assigned(FOnClickDayExt) then FOnClickDayExt(Sender);
end;
procedure TMiPanelDiary.ClickMonth(Sender: TObject);
begin
if Assigned(FOnClickMonth) then FOnClickMonth(Sender);
end;
procedure TMiPanelDiary.ClickNotice(Sender: TObject);
begin
if Assigned(FOnClickNotice) then FOnClickNotice(Sender);
end;
procedure TMiPanelDiary.ClickStation(Sender: TObject);
begin
if Assigned(FOnClickStation) then FOnClickStation(Sender);
end;
procedure TMiPanelDiary.ClickWeeksDays(Sender: TObject);
begin
if Assigned(FOnClickWeeksDays) then FOnClickWeeksDays(Sender);
end;
procedure TMiPanelDiary.ClickYEar(Sender: TObject);
begin
if Assigned(FOnClickYEar) then FOnClickYEar(Sender);
end;
constructor TMiPanelDiary.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
AutoInitialize;
end;
procedure TMiPanelDiary.DateChanged(Sender: TObject);
begin
if Assigned(FOnDateChanged) then FOnDateChanged(Sender);
end;
destructor TMiPanelDiary.Destroy;
begin
AutoDestroy;
inherited Destroy;
end;
procedure TMiPanelDiary.Loaded;
begin
inherited Loaded;
end;[/DELPHI]
[DELPHI]
var VarIHeighAutoHEigt:Integer;
implementation
{ TPanelDiary }
procedure TMiPanelDiary.Alarm(Sender: TObject);
begin
if Assigned(FOnAlarm) then FOnAlarm(Sender);
if FClock.FMessageAlarm<>'' then ShowMessage(FClock.FMessageAlarm);
end;
procedure TMiPanelDiary.AutoDestroy;
begin
FClock.Free;
FClock.FFontClock.Free;
FDay.FFontDay.Free;
FDayExt.FFontDayExt.Free;
FMonth.FFontMonth.Free;
FStation.FFontStation.Free;
FWeeksDays.FFontWeekDays.Free;
FYear.FFontYear.Free;
FPanelNotice.Free;
FPanelStation.Free;
FPanelDayExt.Free;
FPanelDayX.Free;
FPanelMonth.Free;
FPanelYear.Free;
FPanelWeeksDay.Free;
FPanelClock.Free;
FMyTimer.free;
FTexto1.Free;
FTexto2.Free;
end;
procedure TMiPanelDiary.AutoInitialize;
begin
FOnlyOneFont := False;
FDate := Now;
FLanguage := Espanol;
Height := 318;
Width := 177;
FUsarComentarios := True;
Ftipo := Completo;
FAutoheight := False;
//------------------------------------------------Notice
FNotice := TNotice.Create;
Fnotice.FNoticeColor := clBlue;
FNotice.FPanelVisible := False;
FNotice.FText1 := '';
FNotice.FText2 := '';
FNotice.Height := 40;
FNotice.FNoticeFont := TFont.Create;
with FNotice.FNoticeFont do
begin
Color := clYellow;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Estacion
FStation := TStation.Create;
FStation.FColorStation := $0033CCFF;
FStation.FPanelVisible := True;
FStation.FFontStation := TFont.Create;
with FStation.FFontStation do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
FStation.FColorStation := clRed;
//------------------------------------------------Dias Extendidos
FDayExt := TDayExt.Create;
FDayExt.FColorDayExt := $0033CCFF;
FDayExt.FPanelVisible := True;
FDayExt.FFontDayExt := TFont.Create;
with FDayExt.FFontDayExt do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Dia
FDay := TDayX.Create;
FDay.FColorDay := clWhite;
FDay.FHeight := 100;
FDay.FFontDay := TFont.Create;
with FDay.FFontDay do
begin
Color := clBlack;
Name := 'Arial';
Size := 70;
Style := [fsBold]
end;
//------------------------------------------------Mes
FMonth := TMonth.Create;
FMonth.FColorMonth := $0033CCFF;
FMonth.FPanelVisible := True;
FMonth.FFontMonth := TFont.Create;
with FMonth.FFontMonth do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Año
FYear := TYear.Create;
FYear.FColorYear := $0033CCFF;
FYear.FPanelVisible := True;
FYear.FFontYear := TFont.Create;
with FYear.FFontYear do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//------------------------------------------------Semanas dias
FWeeksDays := TWeeksDay.Create;
FWeeksDays.FColorWeeksDays := $0033CCFF;
FWeeksDays.FPanelVisible := True;
FWeeksDays.FFontWeekDays := TFont.Create;
with FWeeksDays.FFontWeekDays do
begin
Color := $00CC3300;
Name := 'Arial';
Size := 12;
Style := [fsBold]
end;
//-------------------------------------------------CLOCK
FClock := TClock.Create;
FClock.FClockEnable := True;
FClock.FPanelVisible := True;
FClock.FFontClock := TFont.Create;
FClock.FClock12_24 := Select12;
FClock.FColorClock := $00FFCCCC;
FClock.FFontClock.color := $00003333;
FClock.FInterval := 1000;
FClock.FAlarmActive := False;
FClock.FHourAlarm := Now;
FClock.FMessageAlarm := '';
FClock.FHour := Now;
FMyTimer:=TTimer.Create(Self); //-------------------------------------------------Timer
with FMyTimer do
begin
Enabled := FClock.FClockEnable;
Interval := FClock.FInterval;
OnTimer := FOnTimer;
end;
FPanelNotice:=TPanel.Create(Self); //------------------------------------------------Notice
with FPanelNotice do
begin
Parent := Self;
TabOrder := 0;
Align := alTop;
Visible := False;
Font := FNotice.FNoticeFont;
Color := FNotice.FNoticeColor;
Visible := FNotice.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Height := FNotice.Height;
Caption :='';
end;
FTexto1:=TLabel.Create(Self);
with FTexto1 do
begin
Parent := FPanelNotice;
Top := 3;
Left := 3;
AutoSize := False;
Width := FPanelNotice.Width-6;
Font := FNotice.FNoticeFont;
Transparent:= True;
Alignment := taCenter
end;
FTexto2:=TLabel.Create(Self);
with FTexto2 do
begin
Parent := FPanelNotice;
Top := 3+FNotice.FNoticeFont.Size+1; //?? +/-
Left := 3;
AutoSize := False;
Width := FPanelNotice.Width;
Font := FNotice.FNoticeFont;
Transparent:= True;
Alignment := taCenter
end;
FPanelDayExt:=TPanel.Create(Self); //------------------------------------------------Dia Extendido
with FPanelDayExt do
begin
Parent := Self;
TabOrder := 1;
Align := alTop;
Font := FDayExt.FontDayExt;
Color := FDayExt.FColorDayExt;
Visible := FDayExt.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :=' Dia ';
end;
FPaneldayx:=TPanel.Create(Self); //------------------------------------------------Dia
with FPanelDayX do
begin
Parent := Self;
TabOrder := 2;
Align := alTop;
Font := FDay.FFontDay;
Color := FDay.FColorDay;
Caption := FormatDateTime('dd',Date);
ParentColor := false;
ParentBackground :=False;
Height := FDay.FHeight;
end;
FPanelMonth:=TPanel.Create(Self); //------------------------------------------------Mes
with FPanelMonth do
begin
Parent := Self;
TabOrder := 3;
Align := alTop;
Font := FMonth.FFontMonth;
Color := FMonth.FColorMonth;
Visible := FMonth.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :='MES';
end;
FPanelYear:=TPanel.Create(Self); //------------------------------------------------Año
with FPanelYear do
begin
Parent := Self;
TabOrder := 4;
Align := alTop;
Font := FYear.FFontYear;
Color := FYear.FColorYear;
Visible := FYear.FPanelVisible;
ParentColor := false;
ParentBackground :=False;
Height := 30;
Caption :=' AÑO ';
end;
FPanelWeeksDay:=TPanel.Create(Self); //------------------------------------------------Semanas Dias
with FPanelWeeksDay do
begin
Parent := Self;
TabOrder := 5;
Align := alTop;
Font := FWeeksDays.FFontWeekDays;
Color := FWeeksDays.FColorWeeksDays;
Visible := FWeeksDays.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Height := 30;
Caption :='Semanas Dias';
end;
FPanelStation:=TPanel.Create(Self); //------------------------------------------------Station
with FPanelStation do
begin
Parent := Self;
TabOrder := 6;
Align := alTop;
Visible := FStation.FPanelVisible;
Font := FStation.FFontStation;
Color := FStation.FColorStation;
ParentColor :=false;
ParentBackground :=False;
Height := 30;
Caption :=' ESTACION ';
end;
FPanelClock:=TPanel.Create(Self); //------------------------------------------------Reloj
with FPanelClock do
begin
Parent := Self;
TabOrder := 7;
Align := alTop;
Font := FClock.FFontClock;
Color := FClock.FColorClock;
Visible := FClock.FPanelVisible;
ParentColor :=false;
ParentBackground :=False;
Visible := True;
Height := 30;
Caption :='Reloj';
end;
end;
procedure TMiPanelDiary.Calculos;
var VariNumeroPaneles:Integer;
begin { Calculamnos la estacion del año semanas y dias }
VariNumeroPaneles:=1;
if FNotice.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FDayExt.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FMonth.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FYear.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FWeeksDays.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FStation.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
if FClock.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
VarIHeighAutoHEigt:=(Self.Height-FDay.FHeight) div (VariNumeroPaneles-1);
end;
procedure TMiPanelDiary.Click;
begin
inherited Click;
end;
procedure TMiPanelDiary.ClickClock(Sender: TObject);
begin
if Assigned(FOnClickClock) then FOnClickClock(Sender);
end;
procedure TMiPanelDiary.ClickDay(Sender: TObject);
begin
if Assigned(FOnClickDay) then FOnClickDay(Sender);
end;
procedure TMiPanelDiary.ClickDayExt(Sender: TObject);
begin
if Assigned(FOnClickDayExt) then FOnClickDayExt(Sender);
end;
procedure TMiPanelDiary.ClickMonth(Sender: TObject);
begin
if Assigned(FOnClickMonth) then FOnClickMonth(Sender);
end;
procedure TMiPanelDiary.ClickNotice(Sender: TObject);
begin
if Assigned(FOnClickNotice) then FOnClickNotice(Sender);
end;
procedure TMiPanelDiary.ClickStation(Sender: TObject);
begin
if Assigned(FOnClickStation) then FOnClickStation(Sender);
end;
procedure TMiPanelDiary.ClickWeeksDays(Sender: TObject);
begin
if Assigned(FOnClickWeeksDays) then FOnClickWeeksDays(Sender);
end;
procedure TMiPanelDiary.ClickYEar(Sender: TObject);
begin
if Assigned(FOnClickYEar) then FOnClickYEar(Sender);
end;
constructor TMiPanelDiary.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
AutoInitialize;
end;
procedure TMiPanelDiary.DateChanged(Sender: TObject);
begin
if Assigned(FOnDateChanged) then FOnDateChanged(Sender);
end;
destructor TMiPanelDiary.Destroy;
begin
AutoDestroy;
inherited Destroy;
end;
procedure TMiPanelDiary.Loaded;
begin
inherited Loaded;
end;[/DELPHI]
#3
Escrito 27 agosto 2013 - 03:56
La 3ª parte
[DELPHI]
procedure TMiPanelDiary.Paint;
function xfsema(ffecha:tDateTime):integer; //Nos da el día de la semana en número
var
texfec:string;
fec: integer;
fec2:string;
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= ffecha;
DecodeDate(Present, Year, Month, Day);
case dayofweek(ffecha)of
1:Fec:=7;
2:Fec:=1;
3:Fec:=2;
4:Fec:=3;
5:Fec:=4;
6:Fec:=5;
7:Fec:=6;
end;
Result:=fec;
end;
function xdiasemana(VDia:integer;Language:TLengua):string; //Muestra el día de la semana
var REDia:string; //Añadir el lenguaje y su traducción
begin
case VDia of
7:case Language of
Espanol:REDia:='Domingo';
Frances:REDia:='Dimanche' ;
Aleman:REDia:='Sonntag' ;
Italiano:REDia:='Domenica' ;
Ingles:REDia:='Sunday' ;
Catalan:REDia:='Diumenge' ;
Gallego:REDia:='Domingo' ;
Vasco:REDia:='Igandea' ;
end;
1:case Language of
Espanol:REDia:='Lunes';
Frances:REDia:='Lundi' ;
Aleman:REDia:='Montag' ;
Italiano:REDia:='Lunedi' ;
Ingles: REDia:='Monday' ;
Catalan:REDia:='Dilluns' ;
Gallego:REDia:='Luns' ;
Vasco: REDia:='Astelehena' ;
end;
2:case Language of
Espanol:REDia:='Martes';
Frances:REDia:='Mardi' ;
Aleman:REDia:='Dienstag' ;
Italiano:REDia:='Martedì' ;
Ingles:REDia:='Tuesday' ;
Catalan:REDia:='Dimarts' ;
Gallego:REDia:='Martes' ;
Vasco:REDia:='Asteartea' ;
end;
3:case Language of
Espanol:REDia:='Miercoles';
Frances: REDia:='Mercredi' ;
Aleman: REDia:='Mittwoch' ;
Italiano:REDia:='Mercoledì' ;
Ingles:REDia:='Wednesday' ;
Catalan:REDia:='Dimecres' ;
Gallego:REDia:='Mércores' ;
Vasco:REDia:='Asteazkena' ;
end;
4:case Language of
Espanol:REDia:='Jueves';
Frances:REDia:='Jeudi' ;
Aleman: REDia:='Donnerstag' ;
Italiano:REDia:='Giovedi' ;
Ingles:REDia:='Thursday' ;
Catalan: REDia:='Dijous' ;
Gallego:REDia:='Xoves' ;
Vasco:REDia:='Osteguna' ;
end;
5:case Language of
Espanol:REDia:='Viernes';
Frances:REDia:='Vendredi' ;
Aleman:REDia:='Freitag' ;
Italiano:REDia:='Venerdì' ;
Ingles:REDia:='Friday' ;
Catalan:REDia:='Divendres' ;
Gallego: REDia:='Venres' ;
Vasco:REDia:='Ostirala' ;
end;
6:case Language of
Espanol:REDia:='Sábado';
Frances:REDia:='Samedi' ;
Aleman:REDia:='Samstag' ;
Italiano:REDia:='Sabato' ;
Ingles:REDia:='Saturday' ;
Catalan: REDia:='Dissabte' ;
Gallego:REDia:='Sábado' ;
Vasco:REDia:='Larunbata' ;
end;
end;
Result:=REDia;
end;
function Mes(ffecha:tDateTime;Language:TLengua):string; //Nos devuelve el mes
var
fec2:string;
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= ffecha;
DecodeDate(Present, Year, Month, Day);
Case month of
1:case Language of
Espanol:fec2:='Enero';
Frances:fec2:='Janvier';
Aleman:fec2:='Januar';
Italiano:fec2:='Gennaio';
Ingles:fec2:='January';
Catalan:fec2:='Gener';
Gallego:fec2:='Xaneiro';
Vasco:fec2:='Urtarrila';
end;
2:case Language of
Espanol:fec2:='Febrero';
Frances:fec2:='Février';
Aleman:fec2:='Februar';
Italiano:fec2:='Febbraio';
Ingles:fec2:='February';
Catalan:fec2:='Febrer';
Gallego:fec2:='Febreiro';
Vasco:fec2:='Otsaila';
end;
3:case Language of
Espanol:fec2:='Marzo';
Frances:fec2:='Mars';
Aleman:fec2:='März';
Italiano:fec2:='Marzo';
Ingles:fec2:='March';
Catalan:fec2:='Març';
Gallego:fec2:='Marzo';
Vasco:fec2:='Martxoa';
end;
4:case Language of
Espanol:fec2:='Abril';
Frances:fec2:='Avril';
Aleman:fec2:='April';
Italiano:fec2:='Aprile';
Ingles:fec2:='April';
Catalan:fec2:='Abril';
Gallego:fec2:='Abril';
Vasco:fec2:='Apirila';
end;
5:case Language of
Espanol:fec2:='Mayo';
Frances:fec2:='Mai';
Aleman:fec2:='Mai';
Italiano:fec2:='Maggio';
Ingles:fec2:='May';
Catalan:fec2:='Maig';
Gallego:fec2:='Maio';
Vasco:fec2:='Maiatzaren';
end;
6:case Language of
Espanol:fec2:='Junio';
Frances:fec2:='Juin';
Aleman:fec2:='Juni';
Italiano:fec2:='Giugno';
Ingles:fec2:='June';
Catalan:fec2:='Juny';
Gallego:fec2:='Xuño';
Vasco:fec2:='Ekaina';
end;
7:case Language of
Espanol:fec2:='Julio';
Frances:fec2:='Juillet';
Aleman:fec2:='Juli';
Italiano:fec2:='Luglio';
Ingles:fec2:='July';
Catalan:fec2:='Juliol';
Gallego:fec2:='Xullo';
Vasco:fec2:='Uztaila';
end;
8:case Language of
Espanol:fec2:='Agosto';
Frances:fec2:='Août';
Aleman:fec2:='August';
Italiano:fec2:='Agosto';
Ingles:fec2:='August';
Catalan:fec2:='Agost';
Gallego:fec2:='Agosto';
Vasco:fec2:='Abuztua';
end;
9:case Language of
Espanol:fec2:='Septiembre';
Frances:fec2:='Septembre';
Aleman:fec2:='September';
Italiano:fec2:='Settembre';
Ingles:fec2:='September';
Catalan:fec2:='Setembre';
Gallego:fec2:='Setembro';
Vasco:fec2:='Iraila';
end;
10:case Language of
Espanol: fec2:='Octubre';
Frances:fec2:='Octobre';
Aleman:fec2:='Oktober';
Italiano:fec2:='Ottobre';
Ingles:fec2:='October';
Catalan:fec2:='Octubre';
Gallego:fec2:='Outubro';
Vasco:fec2:='Urria';
end;
11:case Language of
Espanol:fec2:='Noviembre';
Frances:fec2:='Novembre';
Aleman:fec2:='November';
Italiano:fec2:='Novembre';
Ingles:fec2:='November';
Catalan:fec2:='Novembre';
Gallego:fec2:='Novembro';
Vasco:fec2:='Azaroa';
end;
12:case Language of
Espanol:fec2:='Diciembre';
Frances:fec2:='Décembre';
Aleman:fec2:='Dezember';
Italiano:fec2:='Dicembre';
Ingles:fec2:='December';
Catalan:fec2:='Desembre';
Gallego:fec2:='Decembro';
Vasco:fec2:='Abendua';
end;
end;
Result:=fec2;
end;
function ano(fexc:tdatetime):string; //DEvuelve año en String
var
Present: TDateTime;
Year, Month, Day: Word;
begin
Present:= fexc;
DecodeDate(Present, Year, Month, Day);
Result:=IntToStr(year);
end;
function NumSemana(Fecha:string):String; //Numero de semanas
var
PrimerDia:TDate;
DiaDelPrimerDia:integer;
begin {Calculamos primer dia del año}
PrimerDia:=StrToDate('01/01/'+Copy(Fecha,7,4));
{Calculamos dia de la semana que empieza por lunes}
if DayOfWeek(PrimerDia)-1 =0 then DiaDelPrimerDia:=7
else DiaDelPrimerDia:=DayOfWeek(PrimerDia)-1;
{Calculamos el numero de semana del año}
Result:=IntToStr(Trunc((StrToDate(Fecha)-PrimerDia+DiaDelPrimerDia-1) /7)+1);
end;
function Estaciones(Fecha:TDateTime; Language:TLengua):string;
begin
if (Fecha=StrToDate('21/03/'+ano(Fecha))) or ((Fecha>StrToDate('21/03/'+ano(Fecha))) and (Fecha<StrToDate('21/06/'+ano(Fecha)))) then
begin //Primavera
case Language of
Espanol:Result:='Primavera' ;
Frances:Result:='Printemps' ;
Aleman:Result:='Frühling' ;
Italiano:Result:='Primavera' ;
Ingles:Result:='Spring' ;
Catalan:Result:='Primavera' ;
Gallego:Result:='Primavera' ;
Vasco:Result:='Spring' ;
end;
end;
if (Fecha=StrToDate('21/06/'+ano(Fecha))) or ((Fecha>StrToDate('21/06/'+ano(Fecha))) and (Fecha<StrToDate('23/09/'+ano(Fecha)))) then
begin //Verano
case Language of
Espanol:Result:='Verano' ;
Frances:Result:='Été' ;
Aleman:Result:='Sommer' ;
Italiano:Result:='Estate' ;
Ingles:Result:='Summer' ;
Catalan:Result:='Estiu' ;
Gallego:Result:='Verán' ;
Vasco:Result:='Uda' ;
end;
end;
if (Fecha=StrToDate('23/09/'+ano(Fecha))) or ((Fecha>StrToDate('21/09/'+ano(Fecha))) and (Fecha<StrToDate('21/12/'+ano(Fecha)))) then
begin //Otoño
case Language of
Espanol:Result:='Otoño' ;
Frances:Result:='Automne' ;
Aleman:Result:='Herbst' ;
Italiano:Result:='Autunno' ;
Ingles:Result:='Fall' ;
Catalan:Result:='Tardor' ;
Gallego:Result:='Caer' ;
Vasco:Result:='Erori' ;
end;
end;
if (Fecha=StrToDate('21/12/'+ano(Fecha))) or ((Fecha>StrToDate('21/12/'+ano(Fecha))) and (Fecha<StrToDate('21/03/'+ano(Fecha)))) then
begin //Invierno
case Language of
Espanol:Result:='Invierno' ;
Frances:Result:='Hiver' ;
Aleman:Result:='Winterreifen' ;
Italiano:Result:='Inverno' ;
Ingles:Result:='Winter' ;
Catalan:Result:='Hivern' ;
Gallego:Result:='Inverno' ;
Vasco:Result:='Negua' ;
end;
end;
end;
function Juliana(Fecha:string):string; //días del año que vamos
begin
Result :=IntToStr(trunc(StrToDate(Fecha) -StrToDate('01/01/'+copy(Fecha,7,4)))+1);
end;
function Juliana3(Fecha:string):string; //Dias del año
begin
Result :=IntToStr(trunc(StrToDate('31/12/'+copy(Fecha,7,4)) - StrToDate('01/01/'+copy(Fecha,7,4)))+1);
end;
[/DELPHI]
#4
Escrito 27 agosto 2013 - 03:58
Seguimos con la 4ª (continuación del procedure de la 3ª)
[DELPHI]
var Day,Month,Year:Word;
VarSTextDayExt1, VarSTextDayExt2, VarSTextDayExt3:string;
begin
DecodeDate(Now,Year,Month,Day);
inherited Paint;
Calculos;
if FTipo=Basico then
begin
FNotice.FPanelVisible:=False;
FDayExt.FPanelVisible:=True;
FMonth.FPanelVisible:=True;
FYear.FPanelVisible:=False;
FWeeksDays.FPanelVisible:=False;
FStation.FPanelVisible:=False;
FClock.FPanelVisible:=False;
end;
if FTipo=Extendido then
begin
FNotice.FPanelVisible:=False;
FDayExt.FPanelVisible:=True;
FMonth.FPanelVisible:=True;
FYear.FPanelVisible:=True;
FWeeksDays.FPanelVisible:=False;
FStation.FPanelVisible:=False;
FClock.FPanelVisible:=True;
end;
if FTipo=Completo then
begin
FNotice.FPanelVisible:=True;
FDayExt.FPanelVisible:=True;
FMonth.FPanelVisible:=True;
FYear.FPanelVisible:=True;
FWeeksDays.FPanelVisible:=True;
FStation.FPanelVisible:=True;
FClock.FPanelVisible:=True;
end;
if FNotice.FPanelVisible then //---------------------------------------[Noticias]
begin
FPanelNotice.Visible:=True;
FPanelNotice.Color:=FNotice.FNoticeColor;
if Autoheight then FPanelNotice.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FTexto1.Font:=FMonth.FontMonth else FTexto1.Font:=FNotice.FNoticeFont;
if FTexto1.Caption<>FNotice.FText1 then FTexto1.Caption:=FNotice.FText1;
FTexto1.Width:=FPanelNotice.Width-6;
if FOnlyOneFont then FTexto2.Font:=FMonth.FontMonth else FTexto2.Font:=FNotice.FNoticeFont;
if FTexto2.Caption<>FNotice.FText2 then FTexto2.Caption:=FNotice.FText2;
FTexto2.Width:=FPanelNotice.Width-6;
end else FPanelNotice.Visible:=False;
if FDayExt.FPanelVisible then //---------------------------------------[Dias Extendido]
begin
FPanelDayExt.Visible:=True;
FPanelDayExt.Color:=FDayExt.FColorDayExt;
if Autoheight then FPanelDayExt.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelDayExt.Font:=FMonth.FontMonth else FPanelDayExt.Font:=FDayExt.FFontDayExt;
if UsarComentarios then
begin
case Language of
Espanol:FPanelDayExt.Caption:='Día '+xdiasemana(xfsema(Self.FDate),Language);
Frances:FPanelDayExt.Caption:='Jour '+xdiasemana(xfsema(Self.FDate),Language);
Aleman:FPanelDayExt.Caption:='Tag '+xdiasemana(xfsema(Self.FDate),Language);
Italiano:FPanelDayExt.Caption:='Giorno '+xdiasemana(xfsema(Self.FDate),Language);
Ingles:FPanelDayExt.Caption:='Day '+xdiasemana(xfsema(Self.FDate),Language);
Catalan:FPanelDayExt.Caption:='Dia '+xdiasemana(xfsema(Self.FDate),Language);
Gallego:FPanelDayExt.Caption:='Día '+xdiasemana(xfsema(Self.FDate),Language);
Vasco:FPanelDayExt.Caption:='Egun '+xdiasemana(xfsema(Self.FDate),Language);
end;
end else FPanelDayExt.Caption:=xdiasemana(xfsema(Self.FDate),Language);
end else FPanelDayExt.Visible:=False;
if FPanelDayX.Caption<>FormatDateTime('dd',Date) then FPanelDayX.Caption:=FormatDateTime('dd',Date); //-------------------------[Día]
FPanelDayX.Visible:=true;
FPanelDayX.BringToFront;
FPanelDayX.Height:=FDay.FHeight;
FPanelDayX.Font:=FDay.FontDay;
if FMonth.FPanelVisible then //----------------------------------------[Mes]
begin
FPanelMonth.Visible:=True;
FPanelMonth.Color:=FMonth.FColorMonth;
if Autoheight then FPanelMonth.Height:=VarIHeighAutoHEigt;
FPanelMonth.Font:=FMonth.FFontMonth;
if UsarComentarios then
begin
case Language of
Espanol:FPanelMonth.Caption:='Mes ';
Frances:FPanelMonth.Caption:='Mois ' ;
Aleman:FPanelMonth.Caption:='Monat ' ;
Italiano:FPanelMonth.Caption:='Mese ' ;
Ingles:FPanelMonth.Caption:='Month ' ;
Catalan:FPanelMonth.Caption:='Mes ' ;
Gallego:FPanelMonth.Caption:='Mes ' ;
Vasco:FPanelMonth.Caption:='Hilabetea ' ;
end;
FPanelMonth.Caption:=FPanelMonth.Caption+Mes(Self.FDate,FLanguage);//+mes
end else FPanelMonth.Caption:=Mes(Self.FDate,FLanguage); //MEs
end else FPanelMonth.Visible:=False;
if FYear.FPanelVisible then //----------------------------------------[Año]
begin
FPanelYear.Visible:=True;
FPanelYear.Color:=FYear.FColorYear;
if Autoheight then FPanelYear.Height:=VarIHeighAutoHEigt;
FPanelYear.Font:=FYear.FFontYear;
if UsarComentarios then
begin
case Language of
Espanol:FPanelYear.Caption:='Año ';
Frances:FPanelYear.Caption:='Année ';
Aleman:FPanelYear.Caption:='Jahr ';
Italiano:FPanelYear.Caption:='Anno ';
Ingles:FPanelYear.Caption:='Year ';
Catalan:FPanelYear.Caption:='Any ';
Gallego:FPanelYear.Caption:='Ano ';
Vasco:FPanelYear.Caption:='Urtea ';
end;
FPanelYear.Caption:=FPanelYear.Caption+ano(Self.FDate);//+año
end else FPanelYear.Caption:=ano(Self.FDate); //año
end else FPanelYear.Visible:=False;
if FWeeksDays.FPanelVisible then
begin
FPanelWeeksDay.Visible:=True;
FPanelWeeksDay.Color:=FWeeksDays.FColorWeeksDays;
if Autoheight then FPanelWeeksDay.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelWeeksDay.Font:=FMonth.FontMonth else FPanelWeeksDay.Font:=FWeeksDays.FFontWeekDays;
if UsarComentarios then
begin
case Language of
Espanol:begin
VarSTextDayExt1:='Semanas[ ';
VarSTextDayExt2:=' ] Días[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Frances:begin
VarSTextDayExt1:='Semaines[ ';
VarSTextDayExt2:=' ] Jours[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Aleman: begin
VarSTextDayExt1:='Wochen[ ';
VarSTextDayExt2:=' ] Tage[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Italiano: begin
VarSTextDayExt1:='Settimane[ ';
VarSTextDayExt2:=' ] Giorni[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Ingles: begin
VarSTextDayExt1:='Weeks[ ';
VarSTextDayExt2:=' ] Days[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Catalan:begin
VarSTextDayExt1:='Setmanes[ ';
VarSTextDayExt2:=' ] Dies[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Gallego:begin
VarSTextDayExt1:='Semanas[ ';
VarSTextDayExt2:=' ] Días[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Vasco :begin
VarSTextDayExt1:='Asteak[ ';
VarSTextDayExt2:=' ] Egun[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
end;
FPanelWeeksDay.Caption:=VarSTextDayExt1+ NumSemana(DateToStr(Self.FDate))+'/'+Numsemana('31/12/'+copy(datetostr(Self.Fdate),7,4))+VarSTextDayExt2+
Juliana(DateToStr(Self.FDate))+'/'+Juliana3(DateToStr(Self.FDate))+VarSTextDayExt3;
end else FPanelWeeksDay.Caption:='[ '+ NumSemana(DateToStr(Self.FDate))+'/'+Numsemana('31/12/'+copy(datetostr(Self.fdate),7,4))+' ] [ '+
Juliana(DateToStr(Self.FDate))+'/'+Juliana3(DateToStr(Self.FDate))+' ]';
end else FPanelWeeksDay.Visible:=False;
if FStation.FPanelVisible then //---------------------------------------[Estación]
begin
FPanelStation.Visible:=True;
FPanelStation.Color:=FStation.FColorStation;
if Autoheight then FPanelStation.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelStation.Font:=FMonth.FontMonth else FPanelStation.Font:=FStation.FFontStation;
if UsarComentarios then
begin
case Language of
Espanol: FPanelStation.Caption:='Estación [ ' ; //+Estacion+' ]
Frances: FPanelStation.Caption:='Gare [ ' ; //+Estacion+' ]
Aleman: FPanelStation.Caption:='Bahnhof [ ' ; //+Estacion+' ]
Italiano: FPanelStation.Caption:='Stazione [ ' ; //+Estacion+' ]
Ingles: FPanelStation.Caption:='Station [ ' ; //+Estacion+' ]
Catalan: FPanelStation.Caption:='Estació [ ' ; //+Estacion+' ]
Gallego: FPanelStation.Caption:='Estación [ ' ; //+Estacion+' ]
Vasco: FPanelStation.Caption:='Geltokia [ ' ; //+Estacion+' ]
end;
FPanelStation.Caption:=FPanelStation.Caption+Estaciones(Date,Language)+' ]'; //+Estacion
end else FPanelStation.Caption:=Estaciones(Date,Language); //+Estacion
end else FPanelStation.Visible:=False;
if FClock.FPanelVisible then //-----------------------------------------[Reloj]
begin
FPanelClock.Visible:=True;
FPanelClock.Color:=FClock.FColorClock;
if Autoheight then FPanelClock.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelClock.Font:=FMonth.FontMonth else FPanelClock.Font:=FClock.FFontClock;
if FClock.FClock12_24=Select12 then FPanelClock.Caption:=FormatDateTime('hh:mm AM/PM', now)
else FPanelClock.Caption:=FormatDateTime('hh:mm', now);
if FClock.FAlarmActive then FPanelClock.Caption:=FPanelClock.Caption+' [A]';
end else FPanelStation.Visible:=False;
end;
procedure TMiPanelDiary.Resize;
begin
inherited Resize;
end;
procedure TMiPanelDiary.SetAutoheight(Value: Boolean);
begin
if FAutoheight<>Value then FAutoheight:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetDate(Value: TDate);
begin
if FDate<>Value then FDate := Value;
Invalidate;
end;
procedure TMiPanelDiary.SetLanguage(Value: TLengua);
begin
if FLanguage<>Value then FLanguage:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetOnlyOneFont(Value: Boolean);
begin
if FOnlyOneFont<>Value then FOnlyOneFont:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetTipo(Value: TFormato);
begin
if FTipo<>Value then FTipo:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetUsarComentarios(Value: Boolean);
begin
if FUsarComentarios<>Value then FUsarComentarios:=Value;
Invalidate;
end;
procedure TMiPanelDiary.Timer(Sender: TObject);
begin
if Assigned(FOnTimer) then FOnTimer(Sender);
if FClock.FClockEnable then
begin
if FPanelClock.Visible then
begin
if FClock.FClock12_24=Select12 then FPanelClock.Caption:=FormatDateTime('hh:mm AM/PM', now)
else FPanelClock.Caption:=FormatDateTime('hh:mm', now);
if FClock.FAlarmActive then FPanelClock.Caption:=FPanelClock.Caption+' [A]';
if FClock.FHourAlarm=Now then FOnAlarm(Sender);
end;
end;
end;
{ TClock * }
procedure TClock.SetAlarmActive(Value: Boolean);
begin
if FAlarmActive<>Value then FAlarmActive := Value;
end;
procedure TClock.SetClock12_24(Value: TClockSelected);
begin
if FClock12_24<>Value then FClock12_24 := Value;
end;
procedure TClock.SetClockEnable(Value: Boolean);
begin
if FClockEnable<>Value then FClockEnable := Value;
end;
procedure TClock.SetColorClock(Value: TColor);
begin
if FColorClock<>Value then FColorClock := Value;
end;
procedure TClock.SetFontClock(Value: TFont);
begin
if FFontClock<>Value then FFontClock.Assign(Value);
end;
procedure TClock.SetHourAlarm(Value: TTime);
begin
if FHourAlarm<>Value then FHourAlarm := Value;
end;
procedure TClock.SetInterval(Value: Integer);
begin
if FInterval<>Value then FInterval := Value;
end;
procedure TClock.SetMessageAlarm(Value: string);
begin
if FMessageAlarm<>Value then FMessageAlarm:= Value;
end;
procedure TClock.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TDayX * }
procedure TDayX.SetColorDay(Value: TColor);
begin
if FColorDay<>Value then FColorDay := Value;
end;
procedure TDayX.SetFontDay(Value: TFont);
begin
if FFontDay<>Value then FFontDay.Assign(Value);
end;
procedure TDayX.SetHeight(Value: Integer);
begin
if FHeight<>Value then FHeight := Value;
end;
{ TDayExt * }
procedure TDayExt.SetColorDayExt(Value: TColor);
begin
if FColorDayExt<>Value then FColorDayExt := Value;
end;
procedure TDayExt.SetFontDayExt(Value: TFont);
begin
if FFontDayExt<>Value then FFontDayExt.Assign(Value);
end;
procedure TDayExt.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TMonth * }
procedure TMonth.SetColorMonth(Value: TColor);
begin
if FColorMonth<>Value then FColorMonth := Value;
end;
procedure TMonth.SetFontMonth(Value: TFont);
begin
if FFontMonth<>Value then FFontMonth.Assign(Value);
end;
procedure TMonth.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TYear * }
procedure TYear.SetColorYear(Value: TColor);
begin
if FColorYear<>Value then FColorYear := Value;
end;
procedure TYear.SetFontYear(Value: TFont);
begin
if FFontYear<>Value then FFontYear.Assign(Value);
end;
procedure TYear.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TStation * }
procedure TStation.SetColorStation(Value: TColor);
begin
if FColorStation<>Value then FColorStation := Value;
end;
procedure TStation.SetFontStation(Value: TFont);
begin
if FFontStation<>Value then FFontStation.Assign(Value);
end;
procedure TStation.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TWeeksDay * }
procedure TWeeksDay.SetColorWeeksDays(Value: TColor);
begin
if FColorWeeksDays<>Value then FColorWeeksDays:= Value;
end;
procedure TWeeksDay.SetFontWeekDays(Value: TFont);
begin
if FFontWeekDays<>Value then FFontWeekDays.Assign(Value);
end;
procedure TWeeksDay.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TNotice }
procedure TNotice.SetHeight(Value: Integer);
begin
if FHeight<>Value then FHeight := Value;
end;
procedure TNotice.SetNoticeColor(Value: TColor);
begin
if FNoticeColor<>Value then FNoticeColor := Value;
end;
procedure TNotice.SetNoticeFont(Value: TFont);
begin
if FNoticeFont<>Value then FNoticeFont.Assign(Value);
end;
procedure TNotice.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
procedure TNotice.SetText1(Value: string);
begin
if FText1<>Value then FText1 := Value;
end;
procedure TNotice.SetText2(Value: string);
begin
if FText2<>Value then FText2 := Value;
end;
end.[/DELPHI]
el código de la unidad de registro
[DELPHI]unit URegMiPanelDiary;
interface
uses
Classes, PanelTacCob, mynumpad, UPanelDiary , DesignEditors, DesignIntf;
type
TPanelProperty = class(TClassProperty)
public
function GetAttributes : TPropertyAttributes; override;
end;
procedure Register();
implementation
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(TDayx),nil, '', TPanelProperty);
RegisterComponents('Standard', [TMiPanelDiary]);
end;
{ TPanelTacCobProperty }
function TPanelProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paReadOnly, paSubProperties];
end;
end.[/DELPHI]
No olvidéis poner en el paquete en el requires el "designide.dcp"
He ido solucionando diversos errores, pero no logro solucionar estos dos y me esta atrasando mucho en e el resto del programa.
Como siempre gracias por vuestra ayuda
[DELPHI]
var Day,Month,Year:Word;
VarSTextDayExt1, VarSTextDayExt2, VarSTextDayExt3:string;
begin
DecodeDate(Now,Year,Month,Day);
inherited Paint;
Calculos;
if FTipo=Basico then
begin
FNotice.FPanelVisible:=False;
FDayExt.FPanelVisible:=True;
FMonth.FPanelVisible:=True;
FYear.FPanelVisible:=False;
FWeeksDays.FPanelVisible:=False;
FStation.FPanelVisible:=False;
FClock.FPanelVisible:=False;
end;
if FTipo=Extendido then
begin
FNotice.FPanelVisible:=False;
FDayExt.FPanelVisible:=True;
FMonth.FPanelVisible:=True;
FYear.FPanelVisible:=True;
FWeeksDays.FPanelVisible:=False;
FStation.FPanelVisible:=False;
FClock.FPanelVisible:=True;
end;
if FTipo=Completo then
begin
FNotice.FPanelVisible:=True;
FDayExt.FPanelVisible:=True;
FMonth.FPanelVisible:=True;
FYear.FPanelVisible:=True;
FWeeksDays.FPanelVisible:=True;
FStation.FPanelVisible:=True;
FClock.FPanelVisible:=True;
end;
if FNotice.FPanelVisible then //---------------------------------------[Noticias]
begin
FPanelNotice.Visible:=True;
FPanelNotice.Color:=FNotice.FNoticeColor;
if Autoheight then FPanelNotice.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FTexto1.Font:=FMonth.FontMonth else FTexto1.Font:=FNotice.FNoticeFont;
if FTexto1.Caption<>FNotice.FText1 then FTexto1.Caption:=FNotice.FText1;
FTexto1.Width:=FPanelNotice.Width-6;
if FOnlyOneFont then FTexto2.Font:=FMonth.FontMonth else FTexto2.Font:=FNotice.FNoticeFont;
if FTexto2.Caption<>FNotice.FText2 then FTexto2.Caption:=FNotice.FText2;
FTexto2.Width:=FPanelNotice.Width-6;
end else FPanelNotice.Visible:=False;
if FDayExt.FPanelVisible then //---------------------------------------[Dias Extendido]
begin
FPanelDayExt.Visible:=True;
FPanelDayExt.Color:=FDayExt.FColorDayExt;
if Autoheight then FPanelDayExt.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelDayExt.Font:=FMonth.FontMonth else FPanelDayExt.Font:=FDayExt.FFontDayExt;
if UsarComentarios then
begin
case Language of
Espanol:FPanelDayExt.Caption:='Día '+xdiasemana(xfsema(Self.FDate),Language);
Frances:FPanelDayExt.Caption:='Jour '+xdiasemana(xfsema(Self.FDate),Language);
Aleman:FPanelDayExt.Caption:='Tag '+xdiasemana(xfsema(Self.FDate),Language);
Italiano:FPanelDayExt.Caption:='Giorno '+xdiasemana(xfsema(Self.FDate),Language);
Ingles:FPanelDayExt.Caption:='Day '+xdiasemana(xfsema(Self.FDate),Language);
Catalan:FPanelDayExt.Caption:='Dia '+xdiasemana(xfsema(Self.FDate),Language);
Gallego:FPanelDayExt.Caption:='Día '+xdiasemana(xfsema(Self.FDate),Language);
Vasco:FPanelDayExt.Caption:='Egun '+xdiasemana(xfsema(Self.FDate),Language);
end;
end else FPanelDayExt.Caption:=xdiasemana(xfsema(Self.FDate),Language);
end else FPanelDayExt.Visible:=False;
if FPanelDayX.Caption<>FormatDateTime('dd',Date) then FPanelDayX.Caption:=FormatDateTime('dd',Date); //-------------------------[Día]
FPanelDayX.Visible:=true;
FPanelDayX.BringToFront;
FPanelDayX.Height:=FDay.FHeight;
FPanelDayX.Font:=FDay.FontDay;
if FMonth.FPanelVisible then //----------------------------------------[Mes]
begin
FPanelMonth.Visible:=True;
FPanelMonth.Color:=FMonth.FColorMonth;
if Autoheight then FPanelMonth.Height:=VarIHeighAutoHEigt;
FPanelMonth.Font:=FMonth.FFontMonth;
if UsarComentarios then
begin
case Language of
Espanol:FPanelMonth.Caption:='Mes ';
Frances:FPanelMonth.Caption:='Mois ' ;
Aleman:FPanelMonth.Caption:='Monat ' ;
Italiano:FPanelMonth.Caption:='Mese ' ;
Ingles:FPanelMonth.Caption:='Month ' ;
Catalan:FPanelMonth.Caption:='Mes ' ;
Gallego:FPanelMonth.Caption:='Mes ' ;
Vasco:FPanelMonth.Caption:='Hilabetea ' ;
end;
FPanelMonth.Caption:=FPanelMonth.Caption+Mes(Self.FDate,FLanguage);//+mes
end else FPanelMonth.Caption:=Mes(Self.FDate,FLanguage); //MEs
end else FPanelMonth.Visible:=False;
if FYear.FPanelVisible then //----------------------------------------[Año]
begin
FPanelYear.Visible:=True;
FPanelYear.Color:=FYear.FColorYear;
if Autoheight then FPanelYear.Height:=VarIHeighAutoHEigt;
FPanelYear.Font:=FYear.FFontYear;
if UsarComentarios then
begin
case Language of
Espanol:FPanelYear.Caption:='Año ';
Frances:FPanelYear.Caption:='Année ';
Aleman:FPanelYear.Caption:='Jahr ';
Italiano:FPanelYear.Caption:='Anno ';
Ingles:FPanelYear.Caption:='Year ';
Catalan:FPanelYear.Caption:='Any ';
Gallego:FPanelYear.Caption:='Ano ';
Vasco:FPanelYear.Caption:='Urtea ';
end;
FPanelYear.Caption:=FPanelYear.Caption+ano(Self.FDate);//+año
end else FPanelYear.Caption:=ano(Self.FDate); //año
end else FPanelYear.Visible:=False;
if FWeeksDays.FPanelVisible then
begin
FPanelWeeksDay.Visible:=True;
FPanelWeeksDay.Color:=FWeeksDays.FColorWeeksDays;
if Autoheight then FPanelWeeksDay.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelWeeksDay.Font:=FMonth.FontMonth else FPanelWeeksDay.Font:=FWeeksDays.FFontWeekDays;
if UsarComentarios then
begin
case Language of
Espanol:begin
VarSTextDayExt1:='Semanas[ ';
VarSTextDayExt2:=' ] Días[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Frances:begin
VarSTextDayExt1:='Semaines[ ';
VarSTextDayExt2:=' ] Jours[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Aleman: begin
VarSTextDayExt1:='Wochen[ ';
VarSTextDayExt2:=' ] Tage[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Italiano: begin
VarSTextDayExt1:='Settimane[ ';
VarSTextDayExt2:=' ] Giorni[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Ingles: begin
VarSTextDayExt1:='Weeks[ ';
VarSTextDayExt2:=' ] Days[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Catalan:begin
VarSTextDayExt1:='Setmanes[ ';
VarSTextDayExt2:=' ] Dies[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Gallego:begin
VarSTextDayExt1:='Semanas[ ';
VarSTextDayExt2:=' ] Días[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
Vasco :begin
VarSTextDayExt1:='Asteak[ ';
VarSTextDayExt2:=' ] Egun[ ';
VarSTextDayExt3:=' ]'; //X semanas o dias
end;
end;
FPanelWeeksDay.Caption:=VarSTextDayExt1+ NumSemana(DateToStr(Self.FDate))+'/'+Numsemana('31/12/'+copy(datetostr(Self.Fdate),7,4))+VarSTextDayExt2+
Juliana(DateToStr(Self.FDate))+'/'+Juliana3(DateToStr(Self.FDate))+VarSTextDayExt3;
end else FPanelWeeksDay.Caption:='[ '+ NumSemana(DateToStr(Self.FDate))+'/'+Numsemana('31/12/'+copy(datetostr(Self.fdate),7,4))+' ] [ '+
Juliana(DateToStr(Self.FDate))+'/'+Juliana3(DateToStr(Self.FDate))+' ]';
end else FPanelWeeksDay.Visible:=False;
if FStation.FPanelVisible then //---------------------------------------[Estación]
begin
FPanelStation.Visible:=True;
FPanelStation.Color:=FStation.FColorStation;
if Autoheight then FPanelStation.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelStation.Font:=FMonth.FontMonth else FPanelStation.Font:=FStation.FFontStation;
if UsarComentarios then
begin
case Language of
Espanol: FPanelStation.Caption:='Estación [ ' ; //+Estacion+' ]
Frances: FPanelStation.Caption:='Gare [ ' ; //+Estacion+' ]
Aleman: FPanelStation.Caption:='Bahnhof [ ' ; //+Estacion+' ]
Italiano: FPanelStation.Caption:='Stazione [ ' ; //+Estacion+' ]
Ingles: FPanelStation.Caption:='Station [ ' ; //+Estacion+' ]
Catalan: FPanelStation.Caption:='Estació [ ' ; //+Estacion+' ]
Gallego: FPanelStation.Caption:='Estación [ ' ; //+Estacion+' ]
Vasco: FPanelStation.Caption:='Geltokia [ ' ; //+Estacion+' ]
end;
FPanelStation.Caption:=FPanelStation.Caption+Estaciones(Date,Language)+' ]'; //+Estacion
end else FPanelStation.Caption:=Estaciones(Date,Language); //+Estacion
end else FPanelStation.Visible:=False;
if FClock.FPanelVisible then //-----------------------------------------[Reloj]
begin
FPanelClock.Visible:=True;
FPanelClock.Color:=FClock.FColorClock;
if Autoheight then FPanelClock.Height:=VarIHeighAutoHEigt;
if FOnlyOneFont then FPanelClock.Font:=FMonth.FontMonth else FPanelClock.Font:=FClock.FFontClock;
if FClock.FClock12_24=Select12 then FPanelClock.Caption:=FormatDateTime('hh:mm AM/PM', now)
else FPanelClock.Caption:=FormatDateTime('hh:mm', now);
if FClock.FAlarmActive then FPanelClock.Caption:=FPanelClock.Caption+' [A]';
end else FPanelStation.Visible:=False;
end;
procedure TMiPanelDiary.Resize;
begin
inherited Resize;
end;
procedure TMiPanelDiary.SetAutoheight(Value: Boolean);
begin
if FAutoheight<>Value then FAutoheight:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetDate(Value: TDate);
begin
if FDate<>Value then FDate := Value;
Invalidate;
end;
procedure TMiPanelDiary.SetLanguage(Value: TLengua);
begin
if FLanguage<>Value then FLanguage:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetOnlyOneFont(Value: Boolean);
begin
if FOnlyOneFont<>Value then FOnlyOneFont:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetTipo(Value: TFormato);
begin
if FTipo<>Value then FTipo:=Value;
Invalidate;
end;
procedure TMiPanelDiary.SetUsarComentarios(Value: Boolean);
begin
if FUsarComentarios<>Value then FUsarComentarios:=Value;
Invalidate;
end;
procedure TMiPanelDiary.Timer(Sender: TObject);
begin
if Assigned(FOnTimer) then FOnTimer(Sender);
if FClock.FClockEnable then
begin
if FPanelClock.Visible then
begin
if FClock.FClock12_24=Select12 then FPanelClock.Caption:=FormatDateTime('hh:mm AM/PM', now)
else FPanelClock.Caption:=FormatDateTime('hh:mm', now);
if FClock.FAlarmActive then FPanelClock.Caption:=FPanelClock.Caption+' [A]';
if FClock.FHourAlarm=Now then FOnAlarm(Sender);
end;
end;
end;
{ TClock * }
procedure TClock.SetAlarmActive(Value: Boolean);
begin
if FAlarmActive<>Value then FAlarmActive := Value;
end;
procedure TClock.SetClock12_24(Value: TClockSelected);
begin
if FClock12_24<>Value then FClock12_24 := Value;
end;
procedure TClock.SetClockEnable(Value: Boolean);
begin
if FClockEnable<>Value then FClockEnable := Value;
end;
procedure TClock.SetColorClock(Value: TColor);
begin
if FColorClock<>Value then FColorClock := Value;
end;
procedure TClock.SetFontClock(Value: TFont);
begin
if FFontClock<>Value then FFontClock.Assign(Value);
end;
procedure TClock.SetHourAlarm(Value: TTime);
begin
if FHourAlarm<>Value then FHourAlarm := Value;
end;
procedure TClock.SetInterval(Value: Integer);
begin
if FInterval<>Value then FInterval := Value;
end;
procedure TClock.SetMessageAlarm(Value: string);
begin
if FMessageAlarm<>Value then FMessageAlarm:= Value;
end;
procedure TClock.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TDayX * }
procedure TDayX.SetColorDay(Value: TColor);
begin
if FColorDay<>Value then FColorDay := Value;
end;
procedure TDayX.SetFontDay(Value: TFont);
begin
if FFontDay<>Value then FFontDay.Assign(Value);
end;
procedure TDayX.SetHeight(Value: Integer);
begin
if FHeight<>Value then FHeight := Value;
end;
{ TDayExt * }
procedure TDayExt.SetColorDayExt(Value: TColor);
begin
if FColorDayExt<>Value then FColorDayExt := Value;
end;
procedure TDayExt.SetFontDayExt(Value: TFont);
begin
if FFontDayExt<>Value then FFontDayExt.Assign(Value);
end;
procedure TDayExt.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TMonth * }
procedure TMonth.SetColorMonth(Value: TColor);
begin
if FColorMonth<>Value then FColorMonth := Value;
end;
procedure TMonth.SetFontMonth(Value: TFont);
begin
if FFontMonth<>Value then FFontMonth.Assign(Value);
end;
procedure TMonth.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TYear * }
procedure TYear.SetColorYear(Value: TColor);
begin
if FColorYear<>Value then FColorYear := Value;
end;
procedure TYear.SetFontYear(Value: TFont);
begin
if FFontYear<>Value then FFontYear.Assign(Value);
end;
procedure TYear.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TStation * }
procedure TStation.SetColorStation(Value: TColor);
begin
if FColorStation<>Value then FColorStation := Value;
end;
procedure TStation.SetFontStation(Value: TFont);
begin
if FFontStation<>Value then FFontStation.Assign(Value);
end;
procedure TStation.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TWeeksDay * }
procedure TWeeksDay.SetColorWeeksDays(Value: TColor);
begin
if FColorWeeksDays<>Value then FColorWeeksDays:= Value;
end;
procedure TWeeksDay.SetFontWeekDays(Value: TFont);
begin
if FFontWeekDays<>Value then FFontWeekDays.Assign(Value);
end;
procedure TWeeksDay.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
{ TNotice }
procedure TNotice.SetHeight(Value: Integer);
begin
if FHeight<>Value then FHeight := Value;
end;
procedure TNotice.SetNoticeColor(Value: TColor);
begin
if FNoticeColor<>Value then FNoticeColor := Value;
end;
procedure TNotice.SetNoticeFont(Value: TFont);
begin
if FNoticeFont<>Value then FNoticeFont.Assign(Value);
end;
procedure TNotice.SetPAnelVisible(Value: Boolean);
begin
if FPanelVisible<>Value then FPanelVisible := Value;
end;
procedure TNotice.SetText1(Value: string);
begin
if FText1<>Value then FText1 := Value;
end;
procedure TNotice.SetText2(Value: string);
begin
if FText2<>Value then FText2 := Value;
end;
end.[/DELPHI]
el código de la unidad de registro
[DELPHI]unit URegMiPanelDiary;
interface
uses
Classes, PanelTacCob, mynumpad, UPanelDiary , DesignEditors, DesignIntf;
type
TPanelProperty = class(TClassProperty)
public
function GetAttributes : TPropertyAttributes; override;
end;
procedure Register();
implementation
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(TDayx),nil, '', TPanelProperty);
RegisterComponents('Standard', [TMiPanelDiary]);
end;
{ TPanelTacCobProperty }
function TPanelProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paReadOnly, paSubProperties];
end;
end.[/DELPHI]
No olvidéis poner en el paquete en el requires el "designide.dcp"
He ido solucionando diversos errores, pero no logro solucionar estos dos y me esta atrasando mucho en e el resto del programa.
Como siempre gracias por vuestra ayuda
#6
Escrito 27 agosto 2013 - 01:51
Hola Desart
El problema con el reloj que no cambia se debe a que el evento del Timer está mal asignado.
Solamente hay que cambiar una línea en el procedimiento AutoInitialize
Con respecto a los errores que envía al cerrar la aplicación se deben al orden de destrucción de los componentes. Es decir, estás destruyendo algunos componentes que contienen a otros o están ligados a otros.
Por ejemplo:
Si lo haces de esta forma hay un problema poeque la destruir FClock pierdes la referencia y entonces la siguiente línea fallará
Solamente cambia el orden de esta forma
Por cierto, es muy bueno tu componente. Felicitaciones
El problema con el reloj que no cambia se debe a que el evento del Timer está mal asignado.
Solamente hay que cambiar una línea en el procedimiento AutoInitialize
delphi
FMyTimer:=TTimer.Create(Self); //-------------------------------------------------Timer with FMyTimer do begin Enabled := FClock.FClockEnable; Interval := FClock.FInterval; OnTimer := Timer; // <-------Esta línea cambio end; FPanelNotice:=TPanel.Create(Self); //------------------------------------------------Notice
Con respecto a los errores que envía al cerrar la aplicación se deben al orden de destrucción de los componentes. Es decir, estás destruyendo algunos componentes que contienen a otros o están ligados a otros.
Por ejemplo:
delphi
FClock.Free; FClock.FFontClock.Free;
Si lo haces de esta forma hay un problema poeque la destruir FClock pierdes la referencia y entonces la siguiente línea fallará
Solamente cambia el orden de esta forma
delphi
procedure TMiPanelDiary.AutoDestroy; begin FTexto1.Free; //-- Estos dos textos se destruyen antes FTexto2.Free; FClock.FFontClock.Free; //-- Este se destruye antes que FClock FClock.Free; . . . . end;
Por cierto, es muy bueno tu componente. Felicitaciones
#7
Escrito 28 agosto 2013 - 08:12
Muchas GRACIAS Héctor, como siempre un monstruo, de ayuda impagable.
#8
Escrito 28 agosto 2013 - 12:23
El componente terminado compañeros, en https://gist.github....onymous/6369450, esta las dos unidades , acordaros de separarla