Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 04-11-2013
feliz-58 feliz-58 is offline
Miembro
 
Registrado: sep 2012
Posts: 314
Poder: 14
feliz-58 Va por buen camino
Exclamation Error al instalar un Componente "Year Plan"

Saludos a todos,

Estoy intentando instalar el componente Year Plan y me sale el siguiente error.

Código Delphi [-]
expected an identifier but the end of the file found.

Alguien sabe ¿por que?

Tengo delphi 7
Responder Con Cita
  #2  
Antiguo 05-11-2013
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.441
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Suele pasar cuando te olvidas un ; (punto y coma) al final de una estructura o procedure.

Te está diciendo que busca un

end;

y encuentra el

end.

de final de archivo.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #3  
Antiguo 05-11-2013
feliz-58 feliz-58 is offline
Miembro
 
Registrado: sep 2012
Posts: 314
Poder: 14
feliz-58 Va por buen camino
Cita:
Empezado por Neftali Ver Mensaje
Suele pasar cuando te olvidas un ; (punto y coma) al final de una estructura o procedure.

Te está diciendo que busca un

end;

y encuentra el

end.

de final de archivo.
yo revise el final y su respectivo end; y end. estan hay
Responder Con Cita
  #4  
Antiguo 05-11-2013
Avatar de Casimiro Noteví
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.675
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
Pues pon el código que lo veamos.
Responder Con Cita
  #5  
Antiguo 05-11-2013
feliz-58 feliz-58 is offline
Miembro
 
Registrado: sep 2012
Posts: 314
Poder: 14
feliz-58 Va por buen camino
1

Código Delphi [-]
unit Yearplan;
interface

{ If you want to use a blob stream to load and save data, uncomment the next
  line }
{.$DEFINE USEBLOB}

uses
  {$IFDEF WIN32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF}
  SysUtils, Messages, Classes, Graphics, Controls, Forms, Dialogs, stdctrls,
  ExtCtrls, Menus, {$IFDEF USEBLOB} DBTables, {$ENDIF} Printers;

type
  { Header and footer class }
  TPrintTitle = class(TPersistent)
  private
    fAlignment: TAlignment;
    fCaption: string;
    fFont: TFont;
    fOnChange: TNotifyEvent;
    procedure SetAlignment(Val: TAlignment);
    procedure SetCaption(Val: String);
    procedure SetFont(Val: TFont);
  public
    constructor Create(UpdateEvent: TNotifyEvent);
    destructor Destroy; override;
    procedure UpdateControl;
  published
    property Alignment: TAlignment read fAlignment write SetAlignment default taLeftJustify;
    property Caption: string read fCaption write SetCaption;
    property Font: TFont read fFont write SetFont;
    property OnChange: TNotifyEvent read fOnChange write fOnChange;
  end;

  { Printer options class }
  TPrintOptions = class(TPersistent)
  private
    fPrinterOrientation: TPrinterOrientation;
    fPrintReductionSize: Integer;
    fPrinterLeftMargin, fPrinterRightMargin: Integer;
    fPrinterBottomMargin, fPrinterTopMargin: Integer;
    fPrintHeader: TPrintTitle;
    fPrintFooter: TPrintTitle;
    fPreserveAspect: Boolean;
  public
    constructor Create(UpdateEvent: TNotifyEvent);
    destructor Destroy; override;
  published
    property LeftMargin: Integer read fPrinterLeftMargin write fPrinterLeftMargin default 0;
    property TopMargin: Integer read fPrinterTopMargin write fPrinterTopMargin default 0;
    property RightMargin: Integer read fPrinterRightMargin write fPrinterRightMargin default 0;
    property BottomMargin: Integer read fPrinterBottomMargin write fPrinterBottomMargin default 0;
    property Orientation: TPrinterOrientation read fPrinterOrientation write fPrinterOrientation default poLandscape;
    property ReductionSize: integer read fPrintReductionSize write fPrintReductionSize default 100;
    property PrintHeader: TPrintTitle read fPrintHeader write fPrintHeader;
    property PrintFooter: TPrintTitle read fPrintFooter write fPrintFooter;
    property PreserveAspect: Boolean read fPreserveAspect write fPreserveAspect default True;
  end;

{ YearPlannner component class }
  TypDOW = (ypMonday,ypTuesday,ypWednesday,ypThursday,ypFriday,ypSaturday,ypSunday);
  TypSel = (ypNotSelecting,ypSelecting,ypSelected);
  TypSelSty = (ypNormal,ypRectangle);
  TYearEvent = procedure(StDays,EnDays,StMonth,EnMonth:integer; StartDate,EndDate: TDateTime) of object;
  { Compiling under Delphi 1 limits us to a 64KB data limit, so the record
    cannot be too long.  Under later versions there are bigger data limits }
  TCellData = record
    CellHint: String{$IFNDEF WIN32}[125]{$ENDIF};
    CellColor: TColor;
    CellFont: TFont;
    CustomColor: Boolean;
    CustomFont: Boolean;
    CellDate: TDateTime;
    Selected: Boolean;
    {$IFDEF WIN32}
    CellImage: Integer;
    {$ENDIF}
    Tag: Longint;
  end;
  TCurrentDate = record
    Day,Month: Byte;
  end;
  TYearPlanAbout = (abNone,abAbout);
  TYearPlanner = class(TCustomControl)
  private
    { Private declarations }
    Cells: Array[0..37,0..12] of string[9];
    Heights: Array[0..12] of Integer;
    Widths: Array[0..37] of Integer;
    cX,cY,OldX,OldY: Integer;
    InDay,InMonth: Integer;
    FirstTickCount: {$IFDEF WIN32}Cardinal{$ELSE}LongInt{$ENDIF};
    hPrinting,hUpdating,hWaiting,hWaitingToDestroy: Boolean;
    hSelecting: TypSel;
    HintDate: TDateTime;
    HintWin: THintWindow;
    PrinterPageHeight, PrinterPageWidth: Integer;
    PrinterLeftMargin, PrinterTopMargin: Integer;
    PrinterRightMargin, PrinterBottomMargin: Integer;
    fStartDate: TDateTime;
    fEndDate: TDateTime;
    fabout: TYearPlanAbout;
    fAllowSelections: Boolean;
    fControl: TBitmap;
    fDayColor: TColor;
    fDayFont: TFont;
    {$IFDEF WIN32}
    fEndEllipsis: Boolean;
    {$ENDIF}
    fFlatCells: Boolean;
    fGridLines: Boolean;
    fGridPen: TPen;
    fHeadingColor: TColor;
    fHintColor: TColor;
    fHintFont: TFont;
    fHintDelay: Integer;
    {$IFDEF WIN32}
    fImages: TImageList;
    {$ENDIF}
    fLongHint: Boolean;
    {$IFDEF WIN32}
    fMonthButtons: Boolean;
    {$ENDIF}
    fMonthColor: TColor;
    fMonthFont: TFont;
    fNoDayColor: TColor;
    fNoDayPriority: Boolean;
    fOnSelectionEnd: TNotifyEvent;
    fOnYearChange: TNotifyEvent;
    fOnYearChanged: TNotifyEvent;
    fOnYearDblClick: TYearEvent;
    fOnYearRightClick: TYearEvent;
    fPrintOptions: TPrintOptions;
    fSelectionColor: TColor;
    fSelectionFont: TFont;
    fSelectionStyle: TypSelSty;
    {$IFDEF WIN32}
    fSeperator: Boolean;
    fSoftBorder: Boolean;
    {$ENDIF}
    fShowDefaultHint: Boolean;
    fShowToday: Boolean;
    fStartDayOfWeek: TypDOW;
    fStretchImages: Boolean;
    fStringList: TStringList;
    fTodayCircleColour: TColor;
    fTodayCircleFilled: Boolean;
    fTodayTextColour: TColor;
    fUseBitmap: Boolean;
    fUseFreeSpace: Boolean;
    fWeekendColor: TColor;
    fWeekendHeadingColor: TColor;
    fYear: Word;
    fYearColor: TColor;
    fYearFont: TFont;
    fYearNavigators: Boolean;
    fYearNavLeft: TRect;
    fYearNavRight: TRect;
    function FindFirstWeek(aYear: Word): TDateTime;
    function IsLeapYear(Year: Word): Boolean;
    procedure ProcessSelection;
    procedure CalculateCalendar;
    procedure CalculateData;
    procedure CalculateNavigators;
    procedure CalculateSizes;
    procedure CircleToday(Canvas: TCanvas; CircleRect: TRect; const TodayText: String; InnerColor: TColor);
    procedure OnGridPenChange(Sender:TObject);
    procedure SetupHeadings;
    procedure SetAllowSelections(Val: Boolean);
    procedure SetDayColor(Val: TColor);
    procedure SetDayFont(Val: TFont);
    {$IFDEF WIN32}
    procedure SetEndEllipsis(Val: Boolean);
    {$ENDIF}
    procedure SetFlatCells(Val: Boolean);
    procedure SetGridLines(Val: Boolean);
    procedure SetGridPen(Val: TPen);
    procedure SetHeadingColor(Val: TColor);
    procedure SetHintColor(Val: TColor);
    procedure SetHintFont(Val: TFont);
    procedure SetHintDelay(Val: Integer);
    procedure SetLongHint(Val: Boolean);
    {$IFDEF WIN32}
    procedure SetMonthButtons(Val: Boolean);
    {$ENDIF}
    procedure SetMonthColor(Val: TColor);
    procedure SetMonthFont(Val: TFont);
    procedure SetNoDayColor(Val: TColor);
    procedure SetNoDayPriority(Val: Boolean);
    procedure SetSelectionColor(Val: TColor);
    procedure SetSelectionFont(Val: TFont);
    procedure SetSelectionStyle(Val: TypSelSty);
    {$IFDEF WIN32}
    procedure SetSeperator(Val: Boolean);
    procedure SetSoftBorder(Val: Boolean);
    {$ENDIF}
    procedure SetShowDefaultHint(Val: Boolean);
    procedure SetShowToday(Val: Boolean);
    procedure SetStartDayOfWeek(Val: TypDOW);
    procedure SetStretchImages(Val: Boolean);
    procedure SetTodayCircleColour(Val: TColor);
    procedure SetTodayCircleFilled(Val: Boolean);
    procedure SetTodayTextColour(Val: TColor);
    procedure SetUseFreeSpace(Val: Boolean);
    procedure SetWeekendColor(Val: TColor);
    procedure SetWeekendHeadingColor(Val: TColor);
    procedure SetYear(Val: Word);
    procedure SetYearColor(Val: TColor);
    procedure SetYearFont(Val:TFont);
    procedure SetYearNavigators(Val: Boolean);
    procedure ShowAbout(Val: TYearPlanAbout);
    procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message wm_EraseBkgnd;
    procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message wm_LButtonDblClk;
    procedure WMLButtonDown(var Message: TWMLButtonDown); message wm_LButtonDown;
    procedure WMLButtonUp(var Message: TWMLButtonUp); message wm_LButtonUp;
    procedure WMRButtonDown(var Message: TWMRButtonDown); message wm_RButtonDown;
    procedure WMMouseMove(var Message: TWMMouseMove); message wm_MouseMove;
    procedure WMSize(var Message:TWMSize); message wm_Size;
  protected
    { Protected declarations }
    procedure Paint; override;
  public
    { Public declarations }
    CellData: Array[1..12,1..31] of TCellData;
    CurrentDate: TCurrentDate;
    EnDay: Integer;
    EnMonth: Integer;
    StDay: Integer;
    StMonth: Integer;
    StartDate: TDateTime;
    EndDate: TDateTime;
    procedure XYToCell(X,Y: Integer;var CellX,CellY: Integer);
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure LoadFromFile(var fFile: File);
    procedure LoadFromStream(var fStream:{$IFDEF USEBLOB}TBlobStream{$ELSE}TStream{$ENDIF});
    procedure SaveToFile(var fFile: File);
    procedure SaveToStream(var fStream:{$IFDEF USEBLOB}TBlobStream{$ELSE}TStream{$ENDIF});
    procedure SetColorAtDate(dt: TDateTime; cellColor: TColor; UpdateControl: Boolean);
    procedure SetFontAtDate(dt: TDateTime; cellFont: TFont; UpdateControl: Boolean);
    procedure SetHintAtDate(dt: TDateTime; cellHint: String; UpdateControl: Boolean);
    {$IFDEF WIN32}
    procedure SetImageAtDate(dt: TDateTime; cellImage: Integer; UpdateControl: Boolean);
    {$ENDIF}
    function GetCellData(dt: TDateTime): TCellData;
    procedure Print;
    function GetStartDate: TDateTime;
    function GetEndDate: TDateTime;
    function IsSelected(date: TDateTime): Boolean;
    procedure ClearSelection;
    procedure SelectCells(sDate, eDate: TDateTime);
    procedure SelectWeek(aWeek: Integer);
    procedure ClearCells;
    function WeekNumber(aDate: TDateTime): Integer;
  published
    { Published declarations }
    property about: TYearPlanAbout read fAbout write ShowAbout default abNone;
    property Align;
    property AllowSelections: Boolean read fAllowSelections write SetAllowSelections default True;
    property Color;
    property DayColor: TColor read fDayColor write SetDayColor default clWhite;
    property DayFont:TFont read fDayFont write SetDayFont;
    property DragCursor;
    property DragMode;
    property DrawOffScreen: Boolean read fUseBitmap write fUseBitmap default True;
    property Enabled;
    {$IFDEF WIN32}
    property EndEllipsis: Boolean read fEndEllipsis write SetEndEllipsis default False;
    {$ENDIF}
    property FlatCells: Boolean read fFlatCells write SetFlatCells default True;
    property Font;
    property GridLines: Boolean read fGridLines write SetGridLines default True;
    property GridPen:TPen read fGridPen write SetGridPen;
    property HeadingColor: TColor read fHeadingColor write SetHeadingColor default clGray;
    property HintColor: TColor read fHintColor write SetHintColor default clYellow;
    property HintFont: TFont read fHintFont write SetHintFont;
    property HintDelay: Integer read fHintDelay write SetHintDelay default 0;
    {$IFDEF WIN32}
    property Images: TImageList read fImages write fImages;
    {$ENDIF}
    property LongHint: Boolean read fLongHint write SetLongHint default True;
    {$IFDEF WIN32}
    property MonthButtons: Boolean read fMonthButtons write SetMonthButtons default False;
    {$ENDIF}
    property MonthColor: TColor read fMonthColor write SetMonthColor default clGray;
    property MonthFont:TFont read fMonthFont write SetMonthFont;
    property NoDayColor: TColor read fNoDayColor write SetNoDayColor default clSilver;
    property NoDayPriority: Boolean read fNoDayPriority write SetNoDayPriority default False;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property PrintOptions : TPrintOptions read fPrintOptions write fPrintOptions;
    property SelectionColor: TColor read fSelectionColor write SetSelectionColor default clBlue;
    property SelectionFont: TFont read fSelectionFont write SetSelectionFont;
    property SelectionStyle: TypSelSty read fSelectionStyle write SetSelectionStyle default ypNormal;
    {$IFDEF WIN32}
    property Seperator: Boolean read fSeperator write SetSeperator default True;
    property SoftBorder: Boolean read fSoftBorder write SetSoftBorder default False;
    {$ENDIF}
    property ShowDefaultHint: Boolean read fShowDefaultHint write SetShowDefaultHint default True;
    property ShowHint;
    property ShowToday: Boolean read fShowToday write SetShowToday;
    property StartDayOfWeek: TypDOW read fStartDayOfWeek write SetStartDayOfWeek default ypMonday;
    property StretchImages: Boolean read fStretchImages write SetStretchImages default False;
    property TodayCircleColour: TColor read fTodayCircleColour write SetTodayCircleColour;
    property TodayCircleFilled: Boolean read fTodayCircleFilled write SetTodayCircleFilled default False;
    property TodayTextColour: TColor read fTodayTextColour write SetTodayTextColour;
    property UseFreeSpace: Boolean read fUseFreeSpace write SetUseFreeSpace default True;
    property Visible;
    property WeekendColor: TColor read fWeekendColor write SetWeekendColor default clGray;
    property WeekendHeadingColor: TColor read fWeekendHeadingColor write SetWeekendHeadingColor default clSilver;
    property Year: Word read fYear write SetYear;
    property YearColor: TColor read fYearColor write SetYearColor default clGray;
    property YearFont:TFont read fYearFont write SetYearFont;
    property YearNavigators: Boolean read fYearNavigators write SetYearNavigators default True;
    property OnClick;
    property OnDblClick: TYearEvent read fOnYearDblClick write fOnYearDblClick;
    property OnDragDrop;
    property OnDragOver;
    property OnEndDrag;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnMouseRightClick: TYearEvent read fOnYearRightClick write fOnYearRightClick;
    property OnSelectionEnd: TNotifyEvent read fOnSelectionEnd write fOnSelectionEnd;
    property OnYearChange: TNotifyEvent read fOnYearChange write fOnYearChange;
    property OnYearChanged: TNotifyEvent read fOnYearChanged write fOnYearChanged;
  end;
Responder Con Cita
  #6  
Antiguo 05-11-2013
feliz-58 feliz-58 is offline
Miembro
 
Registrado: sep 2012
Posts: 314
Poder: 14
feliz-58 Va por buen camino
2

Código Delphi [-]
procedure Register;

implementation

{ TYearPlanner }

const
  CopyRightStr: PChar = 'TYearPlanner Component v2.71 (22/05/2002)'+#13+#13+
    'By Jonathan Hosking'+#13+#13+'Compiled in '+
    {$IFDEF VER80}  'Delphi 1.0' {$ENDIF}
    {$IFDEF VER90}  'Delphi 2.0' {$ENDIF}
    {$IFDEF VER100} 'Delphi 3.0' {$ENDIF}
    {$IFDEF VER120} 'Delphi 4.0' {$ENDIF}
    {$IFDEF VER130} 'Delphi 5.0' {$ENDIF}
    {$IFDEF VER140} 'Delphi 6.0' {$ENDIF}
    {$IFDEF VER93}  'C++Builder 1.0' {$ENDIF}
    {$IFDEF VER110} 'C++Builder 3.0' {$ENDIF}
    {$IFDEF VER125} 'C++Builder 4.0' {$ENDIF};
  MonthDays: array[1..12] of Integer = (31,28,31,30,31,30,31,31,30,31,30,31);
var
  CopyRightPtr: Pointer;

{ Thanks to Paul Bailey for this procedure }
constructor TPrintOptions.Create(UpdateEvent : TNotifyEvent);
begin
  inherited Create;
  fPreserveAspect:= True;
  fPrinterOrientation := poLandscape;
  fPrintReductionSize :=  100;
  fPrinterLeftMargin := 0;
  fPrinterTopMargin := 0;
  fPrinterRightMargin := 0;
  fPrinterBottomMargin := 0;
  fPrintHeader := TPrintTitle.Create(nil);
  fPrintFooter := TPrintTitle.Create(nil);
end;

{ Thanks to Paul Bailey for this procedure }
destructor TPrintOptions.Destroy;
begin
  fPrintFooter.Free;
  fPrintHeader.Free;
  inherited Destroy;
end;

{ Thanks to Paul Bailey for this procedure }
procedure TPrintTitle.SetAlignment(Val: TAlignment);
begin
  if fAlignment <> Val then
  begin
    fAlignment := Val;
    UpdateControl;
  end;
end;

{ Thanks to Paul Bailey for this procedure }
procedure TPrintTitle.SetCaption(Val: String);
begin
  if fCaption <> Val then
  begin
    fCaption := Val;
    UpdateControl;
  end;
end;

{ Thanks to Paul Bailey and Wolf Garber for this procedure }
procedure TPrintTitle.SetFont(Val: TFont);
begin
  if fFont <> Val then
  begin
    fFont.Assign(Val);
    UpdateControl;
  end;
end;

{ Thanks to Paul Bailey for this procedure }
constructor TPrintTitle.Create(UpdateEvent: TNotifyEvent);
begin
  inherited Create;
  fFont := TFont.Create;
  fCaption := '';
  fAlignment := taLeftJustify;
end;

{ Thanks to Paul Bailey for this procedure }
destructor TPrintTitle.Destroy;
begin
  fFont.Free;
  inherited Destroy;
end;

{ Thanks to Paul Bailey for this procedure }
procedure TPrintTitle.UpdateControl;
begin
  if Assigned(fOnChange) then fOnChange(Self);
end;

{ Gives you the date of the start of the first whole week in a specified
  year.  The start day is determined by the StartDayOfWeek value }
function TYearPlanner.FindFirstWeek(aYear: Word): TDateTime;
var
  sDay, tDay: Integer;
  sDate: TDateTime;
  dateOk: Boolean;
begin
  { We have to find the first whole week, but this depends on the day when
    a week starts }
  dateOk := False;
  sDay := 1;
  while not dateOk do
  begin
    { Find out what day of the week this date is }
    sDate := EncodeDate(aYear, 1, sDay);
    { Convert Delphi day of week to my day of week array }
    tDay := (DayOfWeek(sDate) + 5) mod 7;
    { Is this the start day ? }
    if tDay = ord(fStartDayOfWeek) then dateOk := True;
    { Try the next day }
    inc(sDay);
  end;
  Result := sDate;
end;

{ Procedure to test for a leap year - This is the routine used in Delphi 5,
  but I have used it here as Delphi 1 did not have such a procedure }
function TYearPlanner.IsLeapYear(Year: Word): Boolean;
begin
  Result := (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));
end;

{ Converts mouse coordinates to cell coordinates }
procedure TYearPlanner.XYToCell(X,Y: Integer;var CellX,CellY: Integer);
begin
  { Work out the column }
  if X < Widths[0] then CellX := 0 else
  begin
    CellX := ((X - Widths[0]) div Widths[1]) + 1;
    if CellX > 37 then CellX := 37;
  end;
  { Work out the row }
  if Y < Heights[0] then CellY := 0 else
  begin
    CellY := ((Y - Heights[0]) div Heights[1]) + 1;
    if CellY > 12 then CellY := 12;
  end;
end;

{ Processes a selection area }
procedure TYearPlanner.ProcessSelection;
var
  sD, eD, sM, eM: Integer;
begin
  { Get the start date from the selected area }
  sD := StDay;
  sM := StMonth;
  eD := EnDay;
  eM := EnMonth;
  if StDay = 0 then Inc(sD);
  if StMonth = 0 then Inc(sM);
  if (StDay > 7) then
    while Cells[sD,sM] = '' do Dec(sD)
  else
    while Cells[sD,sM] = '' do Inc(sD);
  fStartDate := EncodeDate(fYear, sM, StrToInt(Cells[sD,sM]));
  { Get the end date from the selected area }
  if EnDay = 0 then Inc(eD);
  if EnMonth = 0 then Inc(eM);
  if (EnDay > 7) then
    while Cells[eD,eM] = '' do Dec(eD)
  else
    while Cells[eD,eM] = '' do Inc(eD);
  fEndDate := EncodeDate(fYear, eM, StrToInt(Cells[eD,eM]));
end;

{ Reads in the cell data from an open file - Thanks to Jeurgen Jakob and
  Roberto Chieregato for improving this procedure }
procedure TYearPlanner.LoadFromFile(var fFile: File);
var
  fLength, numRead, X, Y: Integer;
begin
  { Read the calender data }
  for X := 1 to 12 do
    for Y := 1 to 31 do
      with CellData[X, Y] do
      begin
        { Read in the cell data }
        BlockRead(fFile, fLength, SizeOf(fLength), numRead);
        if fLength > 0 then
        begin
          {$IFDEF WIN32}
          SetLength(CellHint, fLength);
          {$ENDIF}
          BlockRead(fFile, CellHint[1], fLength, numRead);
        end;
        BlockRead(fFile, CellColor, SizeOf(CellColor), numRead);
        BlockRead(fFile, CellFont, SizeOf(CellFont), numRead);
        BlockRead(fFile, CustomColor, SizeOf(CustomColor), numRead);
        BlockRead(fFile, CustomFont, SizeOf(CustomFont), numRead);
        BlockRead(fFile, CellDate, SizeOf(CellDate), numRead);
        BlockRead(fFile, Selected, SizeOf(Selected), numRead);
        {$IFDEF WIN32}
        BlockRead(fFile, CellImage, SizeOf(CellImage), numRead);
        {$ENDIF}
        BlockRead(fFile, Tag, SizeOf(Tag), numRead);
      end;
end;

{ Reads in the cell data from an open stream - Thanks to Roberto Chieregato for
  improving this procedure }
procedure TYearPlanner.LoadFromStream(var fStream:{$IFDEF USEBLOB}TBlobStream{$ELSE}TStream{$ENDIF});
var
  fLength, X, Y: Integer;
begin
  { Read the calender data }
  for X := 1 to 12 do
    for Y := 1 to 31 do
      with fStream, CellData[X, Y] do
      begin
        { Read in the cell data }
        ReadBuffer(fLength, SizeOf(fLength));
        if fLength > 0 then
        begin
          {$IFDEF WIN32}
          SetLength(CellHint, fLength);
          {$ENDIF}
          ReadBuffer(CellHint[1], fLength);
        end;
        ReadBuffer(CellColor, SizeOf(CellColor));
        ReadBuffer(CellFont, SizeOf(CellFont));
        ReadBuffer(CustomColor, SizeOf(CustomColor));
        ReadBuffer(CustomFont, SizeOf(CustomFont));
        ReadBuffer(CellDate, SizeOf(CellDate));
        ReadBuffer(Selected, SizeOf(Selected));
        {$IFDEF WIN32}
        ReadBuffer(CellImage, SizeOf(CellImage));
        {$ENDIF}
        ReadBuffer(Tag, SizeOf(Tag));
      end;
end;

{ Saves the cell data to an open file - Thanks to Jeurgen Jakob and Roberto
  Chieregato for improving this procedure }
procedure TYearPlanner.SaveToFile(var fFile: File);
var
  fLength, numWritten, X, Y: Integer;
begin
  { Save the calender data }
  for X := 1 to 12 do
    for Y := 1 to 31 do
      with CellData[X, Y] do
      begin
        { Save the cell data }
        fLength := Length(CellHint);
        BlockWrite(fFile, fLength, SizeOf(fLength), numWritten);
        if fLength > 0 then
          BlockWrite(fFile, CellHint[1], fLength, numWritten);
        BlockWrite(fFile, CellColor, SizeOf(CellColor), numWritten);
        BlockWrite(fFile, CellFont, SizeOf(CellFont), numWritten);
        BlockWrite(fFile, CustomColor, SizeOf(CustomColor), numWritten);
        BlockWrite(fFile, CustomFont, SizeOf(CustomFont), numWritten);
        BlockWrite(fFile, CellDate, SizeOf(CellDate), numWritten);
        BlockWrite(fFile, Selected, SizeOf(Selected), numWritten);
        {$IFDEF WIN32}
        BlockWrite(fFile, CellImage, SizeOf(CellImage));
        {$ENDIF}
        BlockWrite(fFile, Tag, SizeOf(Tag), numWritten);
      end;
end;

{ Saves the cell data to an open stream - Thanks to Roberto Chieregato for
  improving this procedure }
procedure TYearPlanner.SaveToStream(var fStream:{$IFDEF USEBLOB}TBlobStream{$ELSE}TStream{$ENDIF});
var
  fLength, X, Y: Integer;
begin
  { Save the calender data }
  for X := 1 to 12 do
    for Y := 1 to 31 do
      with fStream, CellData[X, Y] do
      begin
        { Save the cell data }
        fLength := Length(CellHint);
        WriteBuffer(fLength, SizeOf(fLength));
        if fLength > 0 then
          WriteBuffer(CellHint[1], fLength);
        WriteBuffer(CellColor, SizeOf(CellColor));
        WriteBuffer(CellFont, SizeOf(CellFont));
        WriteBuffer(CustomColor, SizeOf(CustomColor));
        WriteBuffer(CustomFont, SizeOf(CustomFont));
        WriteBuffer(CellDate, SizeOf(CellDate));
        WriteBuffer(Selected, SizeOf(Selected));
        {$IFDEF WIN32}
        WriteBuffer(CellImage, SizeOf(CellImage));
        {$ENDIF}
        WriteBuffer(Tag, SizeOf(Tag));
      end;
end;

{ Thanks to Robert Gesswein for improving this procedure }
procedure TYearPlanner.CalculateCalendar;
var
  I,J: Byte;
  DaysInMonth,StartDay: Integer;
begin
  { Set the Year cell }
  Cells[0, 0] := IntToStr(Self.Year);
  { Clear the cell contents }
  for I := 1 to 37 do
    for J := 1 to 12 do
      Cells[I,J] := '';
  { Setup the cells }
  for I := 1 to 12 do
  begin
    StartDay := DayOfWeek(EncodeDate(Year,I,1));
    StartDay := (StartDay+7-Ord(fStartDayOfWeek)-2) mod 7;
    DaysInMonth := MonthDays[i] + byte(IsLeapYear(Year) and (I = 2));
    for J := 1 to DaysInMonth do Cells[J + StartDay,I] := IntToStr(J);
  end;
end;

{ Thanks to Paul Fisher, Wolfgang Kleinrath and Roberto Chieregato for
  improving this procedure }
procedure TYearPlanner.CalculateData;
var
  I,J: Byte;
  DaysInMonth: Integer;
begin
  { Setup the hints }
  for I := 1 to 12 do
  begin
    DaysInMonth := MonthDays[i] + byte(IsLeapYear(Year) and (I = 2));
    for J := 1 to DaysInMonth do
    begin
      with CellData[I,J] do
      begin
        CellColor := $00000000;
        CellFont := fDayFont;
        CustomColor := False;
        CustomFont := False;
        CellDate := EncodeDate(Year,I,J);
        CellHint := '';
        {$IFDEF WIN32}
        CellImage := -1;
        {$ENDIF}
        Tag := -1;
        Selected := False;
      end;
    end;
  end;
end;

{ Thanks to Max Evans for this routine }
procedure TYearPlanner.CalculateNavigators;
var
  sWidth,sHeight,y: Integer;
begin
  sWidth := GetSystemMetrics(SM_CXHSCROLL);
  sHeight := GetSystemMetrics(SM_CYHSCROLL);
  y := (Heights[0] - sHeight) div 2;
  fYearNavLeft :=  Rect(0 + 1,y,1 + sWidth,y + sHeight);
  fYearNavRight := Rect(Widths[0] - (sWidth + 1),y,Widths[0] - 1,y + sHeight);
end;


{ Thanks to Max Evans, Nacho Urenda and Paul Fisher for helping with this
  procedure }
procedure TYearPlanner.CalculateSizes;
var
  I: Byte;
begin
  { Calculate the cell sizes based on whether or not we are printing or
    using the free space }
  if fUseFreeSpace then
  begin
    Heights[0] := Height - ((Height div 13) * 12);
    Widths[0] := Width - ((Width div 41) * 37);
  end
  else
  begin
    Heights[0] := (Height div 13);
    Widths[0] := (Width div 41) * 4;
  end;
  for I := 1 to 37 do Widths[i] := (Width div 41);
  for I := 1 to 12 do Heights[i] := (Height div 13);
  { Calculate the navigation button sizes }
  CalculateNavigators;
end;

{ Thanks to Max Evans for this routine }
procedure TYearPlanner.CircleToday(Canvas: TCanvas; CircleRect: TRect; const TodayText: String; InnerColor: TColor);
begin
  Canvas.Pen.Color := TodayCircleColour;
  Canvas.Pen.Width := 2;
  Canvas.Brush.Color := InnerColor;
  with CircleRect do
    Canvas.Ellipse(Left, Top, Right, Bottom);
  Canvas.Font.Color := TodayTextColour;
  {$IFDEF WIN32}
  DrawText(Canvas.Handle, PChar(TodayText), -1, CircleRect, DT_VCENTER OR DT_CENTER OR DT_SINGLELINE);
  {$ELSE}
  DrawText(Canvas.Handle, @TodayText[1], -1, CircleRect, DT_VCENTER OR DT_CENTER OR DT_SINGLELINE);
  {$ENDIF}
end;

{ Thanks to Max Evans for this routine }
procedure TYearPlanner.OnGridPenChange(Sender:TObject);
begin
  Invalidate;
end;

{ Thanks to Paolo Prandini, Richard Haven and Robert Gesswein for this
  improved procedure }
procedure TYearPlanner.SetupHeadings;
var
   I,J: Byte;
begin
  for I := 1 to 37 do
  begin
    J := (((I - 1) + (Ord(fStartDayOfWeek))) mod 7) + 2;
    if J = 8 then J := 1;
    Cells[I,0] := ShortDayNames[J][1];
  end;
  for I := 1 to 12 do Cells[0,I] := LongMonthNames[i];
end;

procedure TYearPlanner.SetAllowSelections(Val: Boolean);
begin
  if fAllowSelections <> Val then
  begin
    fAllowSelections := Val;
    Invalidate;
  end;
end;

procedure TYearPlanner.SetDayColor(Val: TColor);
begin
  if fDayColor <> Val then
  begin
    fDayColor := Val;
    Invalidate;
  end;
end;

{ Thanks to Max Evans for this routine }
procedure TYearPlanner.SetDayFont(Val: TFont);
begin
  if fDayFont <> Val then
  begin
    fDayFont.Assign(Val);
    Invalidate;
  end;
end;

{$IFDEF WIN32}
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
Error al instalar componente TDBF mRoman OOP 8 07-04-2010 20:03:09
Error al instalar componente ExportPack 1.2 jlalvarez OOP 1 23-06-2008 12:40:32
Error al instalar componente Manuel Varios 0 23-03-2008 03:20:37
error al instalar componente edusus Varios 3 09-04-2006 21:24:16
Error al instalar componente Dayvis Varios 5 16-03-2005 18:33:48


La franja horaria es GMT +2. Ahora son las 20:01:08.


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