tvplanit: Add missing destruction of Task list inplace editor. Fix Task list inplace editor painting issue.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4714 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-10 21:20:06 +00:00
parent 924efdfcb1
commit 8a7f8615fc
2 changed files with 12 additions and 12 deletions

View File

@ -345,17 +345,18 @@ begin
Margin := 0; Margin := 0;
if (Field = 'Address') or (Field = 'Company') or (Field ='CSZ') then if (Field = 'Address') or (Field = 'Company') or (Field ='CSZ') then
Margin := TextMargin * 2; Margin := TextMargin * 2;
{$IFDEF LCL}
SetBounds( SetBounds(
Left + Margin, Left + Margin,
Top + TextMargin div 2, Top + TextMargin div 2,
Right - Left - TextMargin * 2, Right - Left - TextMargin * 2,
Bottom - Top Bottom - Top
); );
(* {$ELSE}
SetWindowPos(Handle, HWND_TOP, Left + Margin, SetWindowPos(Handle, HWND_TOP, Left + Margin,
Top + (TextMargin div 2), Right - Left - TextMargin * 2, Bottom - Top, Top + (TextMargin div 2), Right - Left - TextMargin * 2, Bottom - Top,
{SWP_SHOWWINDOW or} SWP_NOREDRAW); SWP_NOREDRAW);
*) {$ENDIF}
end; end;
if Redraw then Invalidate; if Redraw then Invalidate;
SetFocus; SetFocus;
@ -466,8 +467,6 @@ end;
destructor TVpContactGrid.Destroy; destructor TVpContactGrid.Destroy;
begin begin
FreeAndNil(cgInplaceEditor);
if (HandleAllocated) and if (HandleAllocated) and
(Assigned (DataStore)) and (Assigned (DataStore)) and
(not (csDesigning in ComponentState)) then (not (csDesigning in ComponentState)) then
@ -476,6 +475,8 @@ begin
cgClickTimer.Free; cgClickTimer.Free;
FContactHeadAttr.Free; FContactHeadAttr.Free;
FDefaultPopup.Free; FDefaultPopup.Free;
FreeAndNil(cgInplaceEditor);
inherited; inherited;
end; end;
{=====} {=====}

View File

@ -110,7 +110,7 @@ type
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure Move(const Loc: TRect; Redraw: Boolean); // procedure Move(const Loc: TRect; Redraw: Boolean);
end; end;
TVpTaskHeadAttr = class(TVpPersistent) TVpTaskHeadAttr = class(TVpPersistent)
@ -451,18 +451,16 @@ begin
{$ENDIF} {$ENDIF}
end; end;
{=====} {=====}
{
procedure TVpTLInPlaceEdit.Move(const Loc: TRect; Redraw: Boolean); procedure TVpTLInPlaceEdit.Move(const Loc: TRect; Redraw: Boolean);
begin begin
CreateHandle; CreateHandle;
Redraw := Redraw or not IsWindowVisible(Handle); Redraw := Redraw or not IsWindowVisible(Handle);
Invalidate; Invalidate;
with Loc do SetBounds(Loc.Left, Loc.Top, Loc.Right-Loc.Left, Loc.Bottom-Loc.Top);
SetWindowPos(Handle, HWND_TOP, Left, Top, Right - Left, Bottom - Top,
{SWP_SHOWWINDOW or} SWP_NOREDRAW);
if Redraw then Invalidate; if Redraw then Invalidate;
SetFocus; SetFocus;
end; end; }
{=====} {=====}
procedure TVpTLInPlaceEdit.CreateParams(var Params: TCreateParams); procedure TVpTLInPlaceEdit.CreateParams(var Params: TCreateParams);
@ -554,6 +552,7 @@ end;
destructor TVpTaskList.Destroy; destructor TVpTaskList.Destroy;
begin begin
FreeAndNil(tlInplaceEditor);
tlClickTimer.Free; tlClickTimer.Free;
FDisplayOptions.Free; FDisplayOptions.Free;
tlAllTaskList.Free; tlAllTaskList.Free;
@ -1528,7 +1527,7 @@ begin
tlInPlaceEditor.OnExit := EndEdit; tlInPlaceEditor.OnExit := EndEdit;
end; end;
tlInplaceEditor.Show; tlInplaceEditor.Show;
tlInPlaceEditor.Move(R, true); tlInPlaceEditor.SetBounds(R.Left, R.Top, R.Right-R.Left, R.Bottom-R.Top); //Move(R, true);
tlInPlaceEditor.Text := FActiveTask.Description; tlInPlaceEditor.Text := FActiveTask.Description;
tlInPlaceEditor.Font.Assign(Font); tlInPlaceEditor.Font.Assign(Font);
tlInPlaceEditor.SelectAll; tlInPlaceEditor.SelectAll;