You've already forked lazarus-ccr
tvplanit: Fix dayview's inplace editor being destroyed (no issue at the moment, but could be - the other controls failed due to that).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4767 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -824,6 +824,8 @@ end;
|
|||||||
destructor TVpDayView.Destroy;
|
destructor TVpDayView.Destroy;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
FreeAndNil(dvInplaceEditor);
|
||||||
|
|
||||||
FTimeSlotColors.Free;
|
FTimeSlotColors.Free;
|
||||||
FHeadAttr.Free;
|
FHeadAttr.Free;
|
||||||
FRowHeadAttr.Free;
|
FRowHeadAttr.Free;
|
||||||
@@ -2254,14 +2256,18 @@ begin
|
|||||||
|
|
||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
{ create and spawn the in-place editor }
|
{ create and spawn the in-place editor }
|
||||||
|
if dvInPlaceEditor = nil then begin
|
||||||
dvInPlaceEditor := TVpDvInPlaceEdit.Create(Self);
|
dvInPlaceEditor := TVpDvInPlaceEdit.Create(Self);
|
||||||
dvInPlaceEditor.Parent := self;
|
dvInPlaceEditor.Parent := self;
|
||||||
dvInPlaceEditor.OnExit := EndEdit;
|
dvInPlaceEditor.OnExit := EndEdit;
|
||||||
dvInPlaceEditor.SetBounds(dvActiveIconRec.Right + FGutterWidth +
|
end;
|
||||||
TextMargin,
|
dvInPlaceEditor.SetBounds(
|
||||||
|
dvActiveIconRec.Right + FGutterWidth + TextMargin,
|
||||||
dvActiveEventRec.Top + TextMargin,
|
dvActiveEventRec.Top + TextMargin,
|
||||||
dvActiveEventRec.Right,
|
dvActiveEventRec.Right,
|
||||||
dvActiveEventRec.Bottom - 1);
|
dvActiveEventRec.Bottom - 1
|
||||||
|
);
|
||||||
|
dvInPlaceEditor.Show;
|
||||||
dvInPlaceEditor.Text := FActiveEvent.Description;
|
dvInPlaceEditor.Text := FActiveEvent.Description;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
dvInPlaceEditor.SetFocus;
|
dvInPlaceEditor.SetFocus;
|
||||||
@@ -2275,7 +2281,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
dvEndingEditing := True;
|
dvEndingEditing := True;
|
||||||
try
|
try
|
||||||
if dvInPlaceEditor <> nil then begin
|
if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible then begin
|
||||||
if dvInPlaceEditor.Text <> FActiveEvent.Description then begin
|
if dvInPlaceEditor.Text <> FActiveEvent.Description then begin
|
||||||
FActiveEvent.Description := dvInPlaceEditor.Text;
|
FActiveEvent.Description := dvInPlaceEditor.Text;
|
||||||
FActiveEvent.Changed := true;
|
FActiveEvent.Changed := true;
|
||||||
@@ -2283,12 +2289,7 @@ begin
|
|||||||
if Assigned(FAfterEdit) then
|
if Assigned(FAfterEdit) then
|
||||||
FAfterEdit(self, FActiveEvent);
|
FAfterEdit(self, FActiveEvent);
|
||||||
end;
|
end;
|
||||||
try
|
dvInplaceEditor.Hide;
|
||||||
dvInPlaceEditor.Free;
|
|
||||||
dvInPlaceEditor := nil;
|
|
||||||
except
|
|
||||||
// The editor was already freed.
|
|
||||||
end;
|
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@@ -2359,7 +2360,7 @@ begin
|
|||||||
{ for simplicity, bail out of editing while scrolling. }
|
{ for simplicity, bail out of editing while scrolling. }
|
||||||
EndEdit(Self);
|
EndEdit(Self);
|
||||||
|
|
||||||
if dvInPlaceEditor <> nil then Exit;
|
if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible then Exit;
|
||||||
|
|
||||||
case Msg.ScrollCode of
|
case Msg.ScrollCode of
|
||||||
SB_LINEUP : dvScrollVertical(-1);
|
SB_LINEUP : dvScrollVertical(-1);
|
||||||
@@ -4050,7 +4051,7 @@ begin
|
|||||||
|
|
||||||
RenderCanvas.Brush.Color := WindowColor;
|
RenderCanvas.Brush.Color := WindowColor;
|
||||||
|
|
||||||
if (dvInPlaceEditor <> nil) then begin
|
if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible then begin
|
||||||
if FActiveEvent = Event then
|
if FActiveEvent = Event then
|
||||||
EventIsEditing := True
|
EventIsEditing := True
|
||||||
else
|
else
|
||||||
@@ -4234,7 +4235,7 @@ begin
|
|||||||
if Assigned (FActiveEvent) then
|
if Assigned (FActiveEvent) then
|
||||||
OKToDrawEditFrame := not (FActiveEvent.AllDayEvent);
|
OKToDrawEditFrame := not (FActiveEvent.AllDayEvent);
|
||||||
|
|
||||||
if (dvInPlaceEditor <> nil) and (OKToDrawEditFrame) then begin
|
if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible and OKToDrawEditFrame then begin
|
||||||
{ paint extra borders around the editor }
|
{ paint extra borders around the editor }
|
||||||
if Assigned (DataStore) then
|
if Assigned (DataStore) then
|
||||||
RenderCanvas.Brush.Color := DataStore.CategoryColorMap.GetColor(
|
RenderCanvas.Brush.Color := DataStore.CategoryColorMap.GetColor(
|
||||||
|
Reference in New Issue
Block a user