diff --git a/components/tvplanit/source/vpmonthview.pas b/components/tvplanit/source/vpmonthview.pas index fe79549f3..2dd47f7a2 100644 --- a/components/tvplanit/source/vpmonthview.pas +++ b/components/tvplanit/source/vpmonthview.pas @@ -698,7 +698,8 @@ var AllowIt: Boolean; EventDlg : TVpEventEditDialog; begin - if DataStore = nil then Exit; + if DataStore = nil then + Exit; if (not IsNewEvent) and (not mvActiveEvent.CanEdit) then begin MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0); @@ -718,7 +719,7 @@ begin EventDlg.Free; end; end; - + if AllowIt then begin mvActiveEvent.Changed := true; DataStore.PostEvents; @@ -732,7 +733,6 @@ begin DataStore.PostEvents; end; Invalidate; - mvActiveEvent := nil; end; procedure TVpMonthView.mvSpinButtonClick(Sender: TObject; Button: TUDBtnType); @@ -1061,6 +1061,8 @@ begin begin { The mouse click landed inside the client area } 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? } if Assigned(FOnEventDblClick) then begin @@ -1068,7 +1070,6 @@ begin FOnEventDblClick(self, mvActiveEvent); end else if mvActiveEvent <> nil then begin - newevent := not SelectEventAtCoord(Point(Msg.XPos, Msg.YPos)); mvSpawnEventEditDialog(newevent); end else if (DataStore.Resource <> nil) then begin @@ -1322,7 +1323,8 @@ var I: Integer; begin 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; break; end;