TvPlanIt: Fix incorrect drag-and-drop operation to or within TVpMonthView (https://forum.lazarus.freepascal.org/index.php/topic,59578.0.html).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8288 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-06-09 20:48:10 +00:00
parent 992ddb6298
commit 09db53cc99

View File

@ -698,7 +698,8 @@ var
AllowIt: Boolean; AllowIt: Boolean;
EventDlg : TVpEventEditDialog; EventDlg : TVpEventEditDialog;
begin begin
if DataStore = nil then Exit; if DataStore = nil then
Exit;
if (not IsNewEvent) and (not mvActiveEvent.CanEdit) then begin if (not IsNewEvent) and (not mvActiveEvent.CanEdit) then begin
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0); MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0);
@ -732,7 +733,6 @@ begin
DataStore.PostEvents; DataStore.PostEvents;
end; end;
Invalidate; Invalidate;
mvActiveEvent := nil;
end; end;
procedure TVpMonthView.mvSpinButtonClick(Sender: TObject; Button: TUDBtnType); procedure TVpMonthView.mvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
@ -1061,6 +1061,8 @@ begin
begin begin
{ The mouse click landed inside the client area } { The mouse click landed inside the client area }
MvSetDateByCoord(Point(Msg.XPos, Msg.YPos)); MvSetDateByCoord(Point(Msg.XPos, Msg.YPos));
newEvent := not SelectEventAtCoord(Point(Msg.XPos, Msg.YPos));
if newEvent then mvActiveEvent := nil;
{ Did the mouse click land on an event? } { Did the mouse click land on an event? }
if Assigned(FOnEventDblClick) then begin if Assigned(FOnEventDblClick) then begin
@ -1068,7 +1070,6 @@ begin
FOnEventDblClick(self, mvActiveEvent); FOnEventDblClick(self, mvActiveEvent);
end else end else
if mvActiveEvent <> nil then begin if mvActiveEvent <> nil then begin
newevent := not SelectEventAtCoord(Point(Msg.XPos, Msg.YPos));
mvSpawnEventEditDialog(newevent); mvSpawnEventEditDialog(newevent);
end else end else
if (DataStore.Resource <> nil) then begin if (DataStore.Resource <> nil) then begin
@ -1322,7 +1323,8 @@ var
I: Integer; I: Integer;
begin begin
for I := 0 to pred(Length(mvMonthdayArray)) do for I := 0 to pred(Length(mvMonthdayArray)) do
if PointInRect(APoint, mvMonthdayArray[I].Rec) then begin if PointInRect(APoint, mvMonthdayArray[I].Rec) then
begin
Date := mvMonthdayArray[I].Date; Date := mvMonthdayArray[I].Date;
break; break;
end; end;