Seguimos con la 4ª (continuación del procedure de la 3ª)
Código 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 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 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); FPanelDayX.Visible:=true;
FPanelDayX.BringToFront;
FPanelDayX.Height:=FDay.FHeight;
FPanelDayX.Font:=FDay.FontDay;
if FMonth.FPanelVisible then 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); end else FPanelMonth.Caption:=Mes(Self.FDate,FLanguage); end else FPanelMonth.Visible:=False;
if FYear.FPanelVisible then 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); end else FPanelYear.Caption:=ano(Self.FDate); 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:=' ]'; end;
Frances:begin
VarSTextDayExt1:='Semaines[ ';
VarSTextDayExt2:=' ] Jours[ ';
VarSTextDayExt3:=' ]'; end;
Aleman: begin
VarSTextDayExt1:='Wochen[ ';
VarSTextDayExt2:=' ] Tage[ ';
VarSTextDayExt3:=' ]'; end;
Italiano: begin
VarSTextDayExt1:='Settimane[ ';
VarSTextDayExt2:=' ] Giorni[ ';
VarSTextDayExt3:=' ]'; end;
Ingles: begin
VarSTextDayExt1:='Weeks[ ';
VarSTextDayExt2:=' ] Days[ ';
VarSTextDayExt3:=' ]'; end;
Catalan:begin
VarSTextDayExt1:='Setmanes[ ';
VarSTextDayExt2:=' ] Dies[ ';
VarSTextDayExt3:=' ]'; end;
Gallego:begin
VarSTextDayExt1:='Semanas[ ';
VarSTextDayExt2:=' ] Días[ ';
VarSTextDayExt3:=' ]'; end;
Vasco :begin
VarSTextDayExt1:='Asteak[ ';
VarSTextDayExt2:=' ] Egun[ ';
VarSTextDayExt3:=' ]'; 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 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 [ ' ; Frances: FPanelStation.Caption:='Gare [ ' ; Aleman: FPanelStation.Caption:='Bahnhof [ ' ; Italiano: FPanelStation.Caption:='Stazione [ ' ; Ingles: FPanelStation.Caption:='Station [ ' ; Catalan: FPanelStation.Caption:='Estació [ ' ; Gallego: FPanelStation.Caption:='Estación [ ' ; Vasco: FPanelStation.Caption:='Geltokia [ ' ; end;
FPanelStation.Caption:=FPanelStation.Caption+Estaciones(Date,Language)+' ]'; end else FPanelStation.Caption:=Estaciones(Date,Language); end else FPanelStation.Visible:=False;
if FClock.FPanelVisible then 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;
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;
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;
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;
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;
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;
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;
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;
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.
el código de la unidad de registro
Código 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;
function TPanelProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paReadOnly, paSubProperties];
end;
end.
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