tvplanit: Move holiday detection event to TVpControlLink; deprecate that of TVpDayView etc.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8492 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-19 21:32:43 +00:00
parent 45da1b1781
commit b864dfc278
9 changed files with 90 additions and 65 deletions

View File

@ -94,7 +94,6 @@ object MainForm: TMainForm
TodayAttributes.BorderPen.Color = clBlue TodayAttributes.BorderPen.Color = clBlue
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
WeekendAttributes.Font.Color = clBlack WeekendAttributes.Font.Color = clBlack
OnHoliday = VpHoliday
end end
object Splitter2: TSplitter object Splitter2: TSplitter
Cursor = crVSplit Cursor = crVSplit
@ -174,7 +173,6 @@ object MainForm: TMainForm
} }
GutterWidth = 5 GutterWidth = 5
WrapStyle = wsNoFlow WrapStyle = wsNoFlow
OnHoliday = VpHoliday
end end
object DaySelectorPanel: TPanel object DaySelectorPanel: TPanel
Left = 0 Left = 0
@ -298,7 +296,6 @@ object MainForm: TMainForm
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabOrder = 2 TabOrder = 2
OnHoliday = VpHoliday
end end
end end
object Tasks: TPage object Tasks: TPage
@ -713,41 +710,41 @@ object MainForm: TMainForm
DrawingStyle = dsCoolTab DrawingStyle = dsCoolTab
FolderCollection = < FolderCollection = <
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Planner' Caption = 'Planner'
Enabled = True Enabled = True
FolderType = ftDefault FolderType = ftDefault
ItemCollection = < ItemCollection = <
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Events' Caption = 'Events'
IconIndex = 0 IconIndex = 0
Name = 'NIEvents' Name = 'NIEvents'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Month view' Caption = 'Month view'
IconIndex = 5 IconIndex = 5
Name = 'NIEventsByMonth' Name = 'NIEventsByMonth'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Week view' Caption = 'Week view'
IconIndex = 4 IconIndex = 4
Name = 'NIEventsByWeek' Name = 'NIEventsByWeek'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Day view' Caption = 'Day view'
IconIndex = 3 IconIndex = 3
Name = 'NIEventsByDay' Name = 'NIEventsByDay'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Tasks' Caption = 'Tasks'
Description = 'Show tasks' Description = 'Show tasks'
IconIndex = 1 IconIndex = 1
@ -755,7 +752,7 @@ object MainForm: TMainForm
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Contacts' Caption = 'Contacts'
Description = 'Show address book' Description = 'Show address book'
IconIndex = 2 IconIndex = 2
@ -767,20 +764,20 @@ object MainForm: TMainForm
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Maintenance' Caption = 'Maintenance'
Enabled = True Enabled = True
FolderType = ftDefault FolderType = ftDefault
ItemCollection = < ItemCollection = <
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Resources' Caption = 'Resources'
IconIndex = 7 IconIndex = 7
Name = 'NIResources' Name = 'NIResources'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption = 'Settings' Caption = 'Settings'
IconIndex = 8 IconIndex = 8
Name = 'NISettings' Name = 'NISettings'
@ -817,12 +814,12 @@ object MainForm: TMainForm
Printer.MarginUnits = imPercent Printer.MarginUnits = imPercent
Printer.PrintFormats = < Printer.PrintFormats = <
item item
Version = 'v1.12' Version = 'v1.0.7'
DayInc = 0 DayInc = 0
DayIncUnits = duDay DayIncUnits = duDay
Elements = < Elements = <
item item
Version = 'v1.12' Version = 'v1.0.7'
Caption.Caption = 'Current week' Caption.Caption = 'Current week'
Caption.Font.Style = [fsItalic] Caption.Font.Style = [fsItalic]
DayOffset = 0 DayOffset = 0
@ -837,12 +834,12 @@ object MainForm: TMainForm
FormatName = 'Events of current week (dayview)' FormatName = 'Events of current week (dayview)'
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
DayInc = 0 DayInc = 0
DayIncUnits = duWeek DayIncUnits = duWeek
Elements = < Elements = <
item item
Version = 'v1.12' Version = 'v1.0.7'
DayOffset = 0 DayOffset = 0
DayOffsetUnits = duDay DayOffsetUnits = duDay
ElementName = 'WeekView' ElementName = 'WeekView'
@ -856,12 +853,12 @@ object MainForm: TMainForm
FormatName = 'Events of current week (Week view)' FormatName = 'Events of current week (Week view)'
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
DayInc = 0 DayInc = 0
DayIncUnits = duDay DayIncUnits = duDay
Elements = < Elements = <
item item
Version = 'v1.12' Version = 'v1.0.7'
DayOffset = 0 DayOffset = 0
DayOffsetUnits = duWeek DayOffsetUnits = duWeek
ElementName = 'TaskList' ElementName = 'TaskList'
@ -875,12 +872,12 @@ object MainForm: TMainForm
FormatName = 'Tasks of current week' FormatName = 'Tasks of current week'
end end
item item
Version = 'v1.12' Version = 'v1.0.7'
DayInc = 0 DayInc = 0
DayIncUnits = duDay DayIncUnits = duDay
Elements = < Elements = <
item item
Version = 'v1.12' Version = 'v1.0.7'
DayOffset = 0 DayOffset = 0
DayOffsetUnits = duDay DayOffsetUnits = duDay
ElementName = 'TaskList' ElementName = 'TaskList'
@ -896,11 +893,12 @@ object MainForm: TMainForm
end> end>
Printer.RightMargin = 5 Printer.RightMargin = 5
Printer.TopMargin = 5 Printer.TopMargin = 5
OnHoliday = VpHoliday
Left = 312 Left = 312
Top = 200 Top = 200
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.0.7'
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
Placement.Top = 10 Placement.Top = 10
@ -1322,7 +1320,7 @@ object MainForm: TMainForm
Top = 344 Top = 344
end end
object VpPrintPreviewDialog1: TVpPrintPreviewDialog object VpPrintPreviewDialog1: TVpPrintPreviewDialog
Version = 'v1.12' Version = 'v1.0.7'
ControlLink = VpControlLink1 ControlLink = VpControlLink1
EndDate = 42561.5151169907 EndDate = 42561.5151169907
MarginUnits = imPercent MarginUnits = imPercent
@ -1337,7 +1335,7 @@ object MainForm: TMainForm
Top = 432 Top = 432
end end
object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog
Version = 'v1.12' Version = 'v1.0.7'
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter

View File

@ -364,6 +364,7 @@ type
{TVpLinkableControl} {TVpLinkableControl}
TVpLinkableControl = class(TVpCustomControl) TVpLinkableControl = class(TVpCustomControl)
protected{private} protected{private}
FDataStore: TVpCustomDataStore; FDataStore: TVpCustomDataStore;
@ -404,50 +405,55 @@ type
property OnMouseWheel; property OnMouseWheel;
end; end;
{TVpControlLink} {TVpControlLink}
TVpControlLink = class(TVpComponent) TVpControlLink = class(TVpComponent)
private private
FPrinter : TVpPrinter; FPrinter: TVpPrinter;
FDataStore : TVpCustomDataStore; FDataStore: TVpCustomDataStore;
FOnGetVariable : TVpOnGetVariableEvent; FLocalization: TVpLocalization;
FOnNoLocalizationFile : TVpNoLocalizationFile; FLocalizationFile: string;
FOnPageStart : TVpOnPageStartEvent; FDefaultCountry: string;
FOnPageEnd : TVpOnPageEndEvent;
FLocalization : TVpLocalization;
FLocalizationFile : string;
FDefaultCountry : string;
FCityStateZipFormat: String; FCityStateZipFormat: String;
FOnGetVariable: TVpOnGetVariableEvent;
FOnHoliday: TVpHolidayEvent;
FOnNoLocalizationFile: TVpNoLocalizationFile;
FOnPageStart: TVpOnPageStartEvent;
FOnPageEnd: TVpOnPageEndEvent;
protected{private} protected{private}
DependentList: TList; DependentList: TList;
procedure ReleaseDependents; procedure ReleaseDependents;
procedure SetCityStateZipFormat(const Value: String); procedure SetCityStateZipFormat(const Value: String);
procedure SetDataStore (const Value : TVpCustomDataStore); procedure SetDataStore(const Value: TVpCustomDataStore);
procedure SetDefaultCountry (const v : string); procedure SetDefaultCountry(const v: string);
procedure SetLocalizationFile (const v : string); procedure SetLocalizationFile(const v: string);
procedure SetPrinter (const v : TVpPrinter); procedure SetPrinter(const v: TVpPrinter);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure Attach(Sender: TComponent); procedure Attach(Sender: TComponent);
procedure Detach(Sender: TComponent); procedure Detach(Sender: TComponent);
function GetDependentList : TList; function GetDependentList: TList;
function IsHoliday(ADate: TDate; out AHolidayName: String): Boolean;
procedure LoadLocalizationInfo (const FileName : string); procedure LoadLocalizationInfo (const FileName : string);
procedure Notify (Sender: TComponent; NotificationType: TVpNotificationType; const Value: Variant); procedure Notify (Sender: TComponent; NotificationType: TVpNotificationType; const Value: Variant);
procedure TriggerOnGetVariable (Sender : TObject; VarName: string; Found: Boolean; var Value: string; var Change: TVpChangeVar); procedure TriggerOnGetVariable (Sender : TObject; VarName: string; Found: Boolean; var Value: string; var Change: TVpChangeVar);
procedure TriggerOnPageEnd (Sender: TObject; PageNum: Integer; ADate: TDateTime; LastPage: Boolean); procedure TriggerOnPageEnd (Sender: TObject; PageNum: Integer; ADate: TDateTime; LastPage: Boolean);
procedure TriggerOnPageStart (Sender: TObject; PageNum: Integer; ADate: TDateTime); procedure TriggerOnPageStart (Sender: TObject; PageNum: Integer; ADate: TDateTime);
property Localization : TVpLocalization read FLocalization write FLocalization; property Localization: TVpLocalization read FLocalization write FLocalization;
published published
property CityStateZipFormat: String read FCityStateZipFormat write SetCityStateZipFormat; property CityStateZipFormat: String read FCityStateZipFormat write SetCityStateZipFormat;
// Use symbols @CITY, @STATE, @ZIP to define the order of these strings // Use symbols @CITY, @STATE, @ZIP to define the order of these strings
property DataStore: TVpCustomDataStore read FDataStore write SetDataStore; property DataStore: TVpCustomDataStore read FDataStore write SetDataStore;
property DefaultCountry : string read FDefaultCountry write SetDefaultCountry; property DefaultCountry: string read FDefaultCountry write SetDefaultCountry;
property LocalizationFile : string read FLocalizationFile write SetLocalizationFile; property LocalizationFile: string read FLocalizationFile write SetLocalizationFile;
property Printer : TVpPrinter read FPrinter write SetPrinter; property Printer: TVpPrinter read FPrinter write SetPrinter;
property OnGetVariable : TVpOnGetVariableEvent read FOnGetVariable write FOnGetVariable; property OnGetVariable: TVpOnGetVariableEvent read FOnGetVariable write FOnGetVariable;
property OnNoLocalizationFile : TVpNoLocalizationFile read FOnNoLocalizationFile write FOnNoLocalizationFile; property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday;
property OnPageStart : TVpOnPageStartEvent read FOnPageStart write FOnPageStart; property OnNoLocalizationFile: TVpNoLocalizationFile read FOnNoLocalizationFile write FOnNoLocalizationFile;
property OnPageEnd : TVpOnPageEndEvent read FOnPageEnd write FOnPageEnd; property OnPageStart: TVpOnPageStartEvent read FOnPageStart write FOnPageStart;
property OnPageEnd: TVpOnPageEndEvent read FOnPageEnd write FOnPageEnd;
end; end;
@ -1596,6 +1602,14 @@ begin
Result := DependentList; Result := DependentList;
end; end;
function TVpControlLink.IsHoliday(ADate: TDate; out AHolidayName: String): Boolean;
begin
AHolidayName := '';
if Assigned(FOnHoliday) then
FOnHoliday(Self, trunc(ADate), AHolidayName);
Result := AHolidayName <> '';
end;
procedure TVpControlLink.LoadLocalizationInfo (const FileName : string); procedure TVpControlLink.LoadLocalizationInfo (const FileName : string);
begin begin
LocalizationFile := FileName; LocalizationFile := FileName;

View File

@ -1464,7 +1464,6 @@ var
Hour1, Minute1, Second1: Word; Hour1, Minute1, Second1: Word;
Hour2, Minute2, Second2: Word; Hour2, Minute2, Second2: Word;
MSecond: Word; MSecond: Word;
TimeStr: string;
begin begin
if FTime = Value then if FTime = Value then
exit; exit;

View File

@ -527,7 +527,7 @@ type
property OnBeforeDrawEvent: TVpOnDVBeforeDrawEvent read FOnBeforeDrawEvent write FOnBeforeDrawEvent; property OnBeforeDrawEvent: TVpOnDVBeforeDrawEvent read FOnBeforeDrawEvent write FOnBeforeDrawEvent;
property OnDeletingEvent: TVpOnDeletingEvent read FOnDeletingEvent write FOnDeletingEvent; property OnDeletingEvent: TVpOnDeletingEvent read FOnDeletingEvent write FOnDeletingEvent;
property OnDrawIcons: TVpOnDVDrawIcons read FOnDrawIcons Write FOnDrawIcons; property OnDrawIcons: TVpOnDVDrawIcons read FOnDrawIcons Write FOnDrawIcons;
property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; deprecated 'Use TControlLink.OnHoliday instead';
property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent; property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent;
property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent; property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent;
property OnClick; property OnClick;
@ -1005,10 +1005,14 @@ end;
function TVpDayView.IsHoliday(ADate: TDate; out AHolidayName: String): Boolean; function TVpDayView.IsHoliday(ADate: TDate; out AHolidayName: String): Boolean;
begin begin
if Assigned(FOnHoliday) then
AHolidayName := ''; AHolidayName := '';
if Assigned(FOnHoliday) then if Assigned(FOnHoliday) then
begin
FOnHoliday(Self, trunc(ADate), AHolidayName); FOnHoliday(Self, trunc(ADate), AHolidayName);
Result := AHolidayName <> ''; Result := AHolidayName <> '';
end else
Result := FControlLink.IsHoliday(ADate, AHolidayName);
end; end;
procedure TVpDayView.LinkHandler(Sender: TComponent; procedure TVpDayView.LinkHandler(Sender: TComponent;

View File

@ -329,7 +329,7 @@ type
// new events // new events
property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent; property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent;
property OnDeletingEvent: TVpOnDeletingEvent read FOnDeletingEvent write FOnDeletingEvent; property OnDeletingEvent: TVpOnDeletingEvent read FOnDeletingEvent write FOnDeletingEvent;
property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; deprecated 'Use TControlLink.OnHoliday instead';
property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent; property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent;
property OwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent; property OwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent;
end; end;
@ -816,8 +816,7 @@ begin
end; end;
{ Determines the date when the earliest event starts, and the date when the { Determines the date when the earliest event starts, and the date when the
latest event ends. latest event ends. }
Stores them in the internal variables FFirstDate and FLastDate. }
procedure TVpGanttView.GetEventDateRange(out AFirstDate, ALastDate: TDate); procedure TVpGanttView.GetEventDateRange(out AFirstDate, ALastDate: TDate);
var var
i: Integer; i: Integer;
@ -826,18 +825,18 @@ var
begin begin
if (Datastore = nil) or (Datastore.Resource = nil) or (Datastore.Resource.Schedule.EventCount = 0) then if (Datastore = nil) or (Datastore.Resource = nil) or (Datastore.Resource.Schedule.EventCount = 0) then
begin begin
FFirstDate := NO_DATE; AFirstDate := NO_DATE;
FLastDate := NO_DATE; ALastDate := NO_DATE;
end else end else
begin begin
event := Datastore.Resource.Schedule.GetEvent(0); event := Datastore.Resource.Schedule.GetEvent(0);
FFirstDate := DatePart(event.StartTime); AFirstDate := DatePart(event.StartTime);
FLastDate := -99999; ALastDate := -99999;
for i := 0 to Datastore.Resource.Schedule.EventCount-1 do for i := 0 to Datastore.Resource.Schedule.EventCount-1 do
begin begin
event := Datastore.Resource.Schedule.GetEvent(i); event := Datastore.Resource.Schedule.GetEvent(i);
d := DatePart(event.EndTime); d := DatePart(event.EndTime);
if d > FLastDate then FLastDate := d; if d > ALastDate then ALastDate := d;
end; end;
end; end;
end; end;
@ -968,8 +967,11 @@ function TVpGanttView.IsHoliday(ADate: TDate; out AHolidayName: String): Boolean
begin begin
AHolidayName := ''; AHolidayName := '';
if Assigned(FOnHoliday) then if Assigned(FOnHoliday) then
begin
FOnHoliday(Self, ADate, AHolidayName); FOnHoliday(Self, ADate, AHolidayName);
Result := AHolidayName <> ''; Result := AHolidayName <> '';
end else
Result := FControlLink.IsHoliday(ADate, AHolidayName);
end; end;
procedure TVpGanttView.KeyDown(var Key: Word; Shift: TShiftState); procedure TVpGanttView.KeyDown(var Key: Word; Shift: TShiftState);

View File

@ -371,7 +371,7 @@ type
property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent; property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent;
property OnEventClick: TVpOnEventClick read FOnEventClick write FOnEventClick; property OnEventClick: TVpOnEventClick read FOnEventClick write FOnEventClick;
property OnEventDblClick: TVpOnEventClick read FOnEventDblClick write FOnEventDblClick; property OnEventDblClick: TVpOnEventClick read FOnEventDblClick write FOnEventDblClick;
property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; deprecated 'Use TControlLink.OnHoliday instead';
property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent; property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent;
property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent; property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent;
end; end;
@ -653,8 +653,11 @@ function TVpMonthView.IsHoliday(ADate: TDate; out AHolidayName: String): Boolean
begin begin
AHolidayName := ''; AHolidayName := '';
if Assigned(FOnHoliday) then if Assigned(FOnHoliday) then
begin
FOnHoliday(Self, ADate, AHolidayName); FOnHoliday(Self, ADate, AHolidayName);
Result := AHolidayName <> ''; Result := AHolidayName <> '';
end else
Result := FControlLink.IsHoliday(ADate, AHolidayName);
end; end;
procedure TVpMonthView.LinkHandler(Sender: TComponent; procedure TVpMonthView.LinkHandler(Sender: TComponent;

View File

@ -14,6 +14,7 @@ object frmPrintPreview: TfrmPrintPreview
OnCreate = FormCreate OnCreate = FormCreate
OnKeyDown = FormKeyDown OnKeyDown = FormKeyDown
OnShow = FormShow OnShow = FormShow
LCLVersion = '2.3.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 56 Height = 56
@ -49,7 +50,7 @@ object frmPrintPreview: TfrmPrintPreview
end end
object ToolButton3: TToolButton object ToolButton3: TToolButton
Left = 55 Left = 55
Height = 25 Height = 5
Top = 0 Top = 0
Caption = 'ToolButton3' Caption = 'ToolButton3'
ImageIndex = 2 ImageIndex = 2
@ -85,7 +86,7 @@ object frmPrintPreview: TfrmPrintPreview
end end
object ToolButton8: TToolButton object ToolButton8: TToolButton
Left = 152 Left = 152
Height = 25 Height = 5
Top = 0 Top = 0
Caption = 'ToolButton8' Caption = 'ToolButton8'
ImageIndex = 6 ImageIndex = 6

View File

@ -164,7 +164,8 @@ implementation
{$ENDIF} {$ENDIF}
uses uses
VpConst, VpPrtFmt; VpConst, // needed for define VP_LCL_SCALING
VpPrtFmt;
{ TfrmPrintPreview } { TfrmPrintPreview }

View File

@ -372,7 +372,7 @@ type
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit; property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent; property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent;
property OnDeletingEvent: TVpOnDeletingEvent read FOnDeletingEvent write FOnDeletingEvent; property OnDeletingEvent: TVpOnDeletingEvent read FOnDeletingEvent write FOnDeletingEvent;
property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; property OnHoliday: TVpHolidayEvent read FOnHoliday write FOnHoliday; deprecated 'Use TControlLink.OnHoliday instead';
property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent; property OnModifyEvent: TVpOnModifyEvent read FOnModifyEvent write FOnModifyEvent;
property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent; property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent;
end; end;
@ -779,8 +779,11 @@ function TVpWeekView.IsHoliday(ADate: TDate; out AHolidayName: String): Boolean;
begin begin
AHolidayName := ''; AHolidayName := '';
if Assigned(FOnHoliday) then if Assigned(FOnHoliday) then
begin
FOnHoliday(Self, ADate, AHolidayName); FOnHoliday(Self, ADate, AHolidayName);
Result := AHolidayName <> ''; Result := AHolidayName <> '';
end else
Result := FControlLink.IsHoliday(ADate, AHolidayName);
end; end;
procedure TVpWeekView.LinkHandler(Sender: TComponent; procedure TVpWeekView.LinkHandler(Sender: TComponent;