Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
Solicito ayuda para resolver los problemas de este nuevo componente

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

Código 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;
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #2  
Antiguo 27-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
2ª parte del código

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;
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #3  
Antiguo 27-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
La 3ª parte

Código 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'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'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'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'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;
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #4  
Antiguo 27-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
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     //---------------------------------------[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.

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;

{ TPanelTacCobProperty }

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
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #5  
Antiguo 27-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
Aquí el código completo

https://gist.github.com/anonymous/6351726
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #6  
Antiguo 28-08-2013
beginner01 beginner01 is offline
Miembro
NULL
 
Registrado: mar 2011
Ubicación: República Dominicana
Posts: 181
Poder: 14
beginner01 Va por buen camino
Hola.

El "Access Violation" que te salta al cerrar la aplicación es por los TLabel que tienes que estas liberando su Parent primero
y por ende este los libera y cuando intentas liberarlos tu ya sus referencias no son válidas. En tu caso se resuelve poniendo
los Tlabel de primero en el orden, así se liberan ellos y luego sus Parent.


Código Delphi [-]
procedure TMiPanelDiary.AutoDestroy;
begin

     FTexto1.Free;
     FTexto2.Free;
     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;

end;

Nota: Otra opción, es permitir que sea el Owner de estos controles el que los libere, ya que se los estás asignando.
Responder Con Cita
  #7  
Antiguo 28-08-2013
beginner01 beginner01 is offline
Miembro
NULL
 
Registrado: mar 2011
Ubicación: República Dominicana
Posts: 181
Poder: 14
beginner01 Va por buen camino
Saludos.

Mirando lo del reloj que no cambia, supongo que es el reloj, que está en la última franja al final, en ese caso es porque esta en
el método Paint del panel por lo que este solo se va a actualizar cuando el repintado sea requerido.

Seria bueno ver ese punto porque entiendo que quien cambiaría los valores de hora sería un Timer por ejemplo, para que la hora
se actualice sin necesidad de que sea por el Paint del componente. Digo ver porque no se exactamente que se espera ahí.
Responder Con Cita
  #8  
Antiguo 28-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
muchas Gracias beginner01, tomo nota y pasare a las correcciones, os mantengo informados.
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #9  
Antiguo 28-08-2013
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.410
Poder: 22
fjcg02 Va camino a la fama
Un par de puntualizaciones:

en euskera, se dice así:
Invierno, Primavera, Verano, Otoño : Negua, Udaberria, Uda, Udazkena

Día: Eguna

Mayo : Maiatza

Estación: no estoy seguro, pero no es geltoki, eso es estación de tren, metro o autobús. Casi seguro que es urtaroa

Es una tontería, pero corrigiendo esos detalles te quedará fetén.

Un saludo
__________________
Cuando los grillos cantan, es que es de noche - viejo proverbio chino -
Responder Con Cita
  #10  
Antiguo 28-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
-Gracias Javier, a veces San Google Traductor, no funciona todo lo bien que debiera, paso a corregirlo.
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #11  
Antiguo 28-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
Javier y días es Egun
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #12  
Antiguo 28-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
El componente terminado compañeros, en https://gist.github.com/anonymous/6369450, esta las dos unidades , acordaros de separarla
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema al agrandar este nuevo componente José Luis Garcí OOP 6 01-06-2013 14:55:04
Solicito ayuda para definir funciones sobre estándar de fechas ISO o SQL Al González [GH Freebrary] 23 28-04-2013 04:39:11
Un par de problemas sin resolver con consultas. SaLvaGe SQL 7 01-10-2004 17:39:38
Componente para resolver sistemas de ecuaciones no lineales? manueles OOP 2 25-12-2003 06:28:39
Ayuda con nuevo componente mosorio OOP 2 14-07-2003 13:33:09


La franja horaria es GMT +2. Ahora son las 06:25:49.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi