Class TCalenPnl (unit Calpnl)

Inherits from

TCustomPanel

Record

Constructors


constructor Create(AOwner: TComponent);



Functions

procedure DateChange;


function DaysInMonth(nMonth, nYear : Integer): Integer;

day of week for 1st of month

procedure DrawButtons;

VK_Escape : FormCancel;

procedure DrawDates;

reset Days <> Bold} { Draw line below days

procedure DrawDaysHeader;


procedure DrawFocusFrame(nIndex : Integer);

2nd test

procedure DrawMonthHeader;

take out 2 iHBorder for spacing at top

function GetIndexFromDate : Integer;

here after compile, losing ones place!

function GetIndexFromPoint(nLeft : Integer ; nTop : Integer) : Integer;


function GetLeftButtonRect : TRect;

Check if mouse was pressed in date area} // ouch!

function GetMonthBegin: Integer;


function GetRectFromIndex(nIndex : Integer): TRect;

Restore Canvas settings

function GetRightButtonRect : TRect;

Define Left Button Rectangle

function IsLeapYear(AYear: Integer): Boolean;

leap-year Feb is special

procedure KeyDown(var Key: Word; Shift: TShiftState);

Define Right Button Rectangle

procedure LoadDateArray;

OPTIMIZE: can it go outside loop?

procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);


procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

Cycle through the days

procedure Paint;


function SetDate(nDays : Integer): Boolean;


function ValidDate(aDate: TDateType) : Boolean;

Reload Date Array & paint ONLY if month or year changed

function DOY (y, m, d : Word): Integer;


function GetDayOfYear: Integer;

DayOfYear

function GetDaysInYear: integer;


function GetShowDate: Boolean;


function GetUseLongDate: Boolean;


function GetWeekNumber: Integer;


function JulDate1stWeek(JD : TDateTime) : TDateTime;

my turn - white line on arrows

procedure SetCalendarDate(aDate: TDateTime);

is cool as no exception is generated by invalid date

procedure SetDay(Value: Integer);

2nd test

procedure SetDayWidth(Value: TDayWidth);


procedure SetMonth(Value: Integer);


procedure SetShowDate(Value: Boolean);


procedure SetUseLongDate(Value: Boolean);


procedure SetYear(Value: Integer);

2nd test

function WeekNo(JDate : TDateTime): Integer;

-Return the Date of the first day in the week of Julian Year

Properties

property Align :


property BevelInner :


property BevelOuter :


property BevelWidth :


property BorderStyle :


property BorderWidth :


property Color :


property Ctl3D :


property Cursor :


property DayWidth : TDayWidth

defaults to False

property DragCursor :


property DragMode :


property Enabled :


property Font :


property Height :


property HelpContext :


property Hint :


property Left :


property Locked :


property Name :


property ParentColor :


property ParentCtl3D :


property ParentFont :


property ParentShowHint :


property PopupMenu :


property ShowDate : Boolean


property ShowHint :


property TabOrder :


property TabStop :


property Tag :


property Top :


property UseLongDate : Boolean


property Visible :


property Width :


property CalendarDate : TDateTime


property Day : Integer


property DayOfYear : Integer


property DaysInYear : Integer


property Month : Integer


property WeekNumber : Integer


property Year : Integer


Events

event OnClick :


event OnDateChange : TNotifyEvent


event OnDblClick :


event OnDragDrop :


event OnDragOver :


event OnEndDrag :


event OnEnter :


event OnExit :


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


event OnResize :


Variables

CalendarRect : TRect;


FButton : TMouseButton;


FButtonDown : Boolean;


FCalendarDate : TDateTime;


FDay : Integer;


FDayOfYear : Integer;


FDaysInYear : Integer;


FDayWidth : TDayWidth;


FMonth : Integer;


FOnDateChange : TNotifyEvent;


FOnDblClick : TNotifyEvent;

moved from const to enable Int ShortDayNames

FShowDate : Boolean;


FUseLongDate : Boolean;


FWeekNumber : Integer;


FYear : Integer;


g_CurrDateIndex : Integer;


g_DateArray : array[1..42] of string[2];


g_DayTitles : Array[0..6] of string[3];


g_MouseDown : BOOL;


g_PrevDateIndex : Integer;


g_PrevMonth : Word;


g_PrevYear : Word;


g_RectHeight : Integer;


g_Width : Integer;


HeadingRect : TRect;



Constructors


constructor Create(AOwner: TComponent);


Functions


procedure DateChange;


function DaysInMonth(nMonth, nYear : Integer): Integer;

day of week for 1st of month


procedure DrawButtons;

VK_Escape : FormCancel;


procedure DrawDates;

reset Days <> Bold} { Draw line below days


procedure DrawDaysHeader;


procedure DrawFocusFrame(nIndex : Integer);

2nd test


procedure DrawMonthHeader;

take out 2 iHBorder for spacing at top


function GetIndexFromDate : Integer;

here after compile, losing ones place!


function GetIndexFromPoint(nLeft : Integer ; nTop : Integer) : Integer;


function GetLeftButtonRect : TRect;

Check if mouse was pressed in date area} // ouch!


function GetMonthBegin: Integer;


function GetRectFromIndex(nIndex : Integer): TRect;

Restore Canvas settings


function GetRightButtonRect : TRect;

Define Left Button Rectangle


function IsLeapYear(AYear: Integer): Boolean;

leap-year Feb is special


procedure KeyDown(var Key: Word; Shift: TShiftState);

Define Right Button Rectangle


procedure LoadDateArray;

OPTIMIZE: can it go outside loop?


procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);


procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

Cycle through the days


procedure Paint;


function SetDate(nDays : Integer): Boolean;


function ValidDate(aDate: TDateType) : Boolean;

Reload Date Array & paint ONLY if month or year changed


function DOY (y, m, d : Word): Integer;


function GetDayOfYear: Integer;

DayOfYear


function GetDaysInYear: integer;


function GetShowDate: Boolean;


function GetUseLongDate: Boolean;


function GetWeekNumber: Integer;


function JulDate1stWeek(JD : TDateTime) : TDateTime;

my turn - white line on arrows


procedure SetCalendarDate(aDate: TDateTime);

is cool as no exception is generated by invalid date


procedure SetDay(Value: Integer);

2nd test


procedure SetDayWidth(Value: TDayWidth);


procedure SetMonth(Value: Integer);


procedure SetShowDate(Value: Boolean);


procedure SetUseLongDate(Value: Boolean);


procedure SetYear(Value: Integer);

2nd test


function WeekNo(JDate : TDateTime): Integer;

-Return the Date of the first day in the week of Julian Year


Properties


property Align :


property BevelInner :


property BevelOuter :


property BevelWidth :


property BorderStyle :


property BorderWidth :


property Color :


property Ctl3D :


property Cursor :


property DayWidth : TDayWidth

defaults to False


property DragCursor :


property DragMode :


property Enabled :


property Font :


property Height :


property HelpContext :


property Hint :


property Left :


property Locked :


property Name :


property ParentColor :


property ParentCtl3D :


property ParentFont :


property ParentShowHint :


property PopupMenu :


property ShowDate : Boolean


property ShowHint :


property TabOrder :


property TabStop :


property Tag :


property Top :


property UseLongDate : Boolean


property Visible :


property Width :


property CalendarDate : TDateTime


property Day : Integer


property DayOfYear : Integer


property DaysInYear : Integer


property Month : Integer


property WeekNumber : Integer


property Year : Integer


Events


event OnClick :


event OnDateChange : TNotifyEvent


event OnDblClick :


event OnDragDrop :


event OnDragOver :


event OnEndDrag :


event OnEnter :


event OnExit :


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


event OnResize :


Variables


CalendarRect : TRect;


FButton : TMouseButton;


FButtonDown : Boolean;


FCalendarDate : TDateTime;


FDay : Integer;


FDayOfYear : Integer;


FDaysInYear : Integer;


FDayWidth : TDayWidth;


FMonth : Integer;


FOnDateChange : TNotifyEvent;


FOnDblClick : TNotifyEvent;

moved from const to enable Int ShortDayNames


FShowDate : Boolean;


FUseLongDate : Boolean;


FWeekNumber : Integer;


FYear : Integer;


g_CurrDateIndex : Integer;


g_DateArray : array[1..42] of string[2];


g_DayTitles : Array[0..6] of string[3];


g_MouseDown : BOOL;


g_PrevDateIndex : Integer;


g_PrevMonth : Word;


g_PrevYear : Word;


g_RectHeight : Integer;


g_Width : Integer;


HeadingRect : TRect;