You've already forked lazarus-ccr
tvplanit: Fix crash due to inplace editor of ContactsGrid
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4706 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -344,10 +344,18 @@ begin
|
|||||||
with Loc do begin
|
with Loc do 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;
|
||||||
|
SetBounds(
|
||||||
|
Left + Margin,
|
||||||
|
Top + TextMargin div 2,
|
||||||
|
Right - Left - TextMargin * 2,
|
||||||
|
Bottom - Top
|
||||||
|
);
|
||||||
|
(*
|
||||||
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_SHOWWINDOW or} SWP_NOREDRAW);
|
||||||
|
*)
|
||||||
end;
|
end;
|
||||||
if Redraw then Invalidate;
|
if Redraw then Invalidate;
|
||||||
SetFocus;
|
SetFocus;
|
||||||
@ -458,6 +466,8 @@ 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
|
||||||
@ -1920,7 +1930,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
{ Column sizing happens here...}
|
{ Column sizing happens here...}
|
||||||
{ if the in-place editor is active then kill it. }
|
{ if the in-place editor is active then kill it. }
|
||||||
if cgInPlaceEditor <> nil then
|
if cgInPlaceEditor.Visible then
|
||||||
EndEdit(self);
|
EndEdit(self);
|
||||||
|
|
||||||
if cgDragBarNumber = -1 then begin
|
if cgDragBarNumber = -1 then begin
|
||||||
@ -2084,7 +2094,7 @@ procedure TVpContactGrid.WMKillFocus(var Msg : TWMKillFocus);
|
|||||||
procedure TVpContactGrid.WMKillFocus(var Msg : TLMKillFocus);
|
procedure TVpContactGrid.WMKillFocus(var Msg : TLMKillFocus);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if (cgInPlaceEditor = nil) then
|
if not cgInplaceEditor.Visible then
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
@ -2219,9 +2229,12 @@ begin
|
|||||||
|
|
||||||
if field <> '' then begin
|
if field <> '' then begin
|
||||||
{ create and spawn the in-place editor }
|
{ create and spawn the in-place editor }
|
||||||
cgInPlaceEditor := TVpCGInPlaceEdit.Create(Self);
|
if cgInplaceEditor = nil then begin
|
||||||
cgInPlaceEditor.Parent := self;
|
cgInPlaceEditor := TVpCGInPlaceEdit.Create(Self);
|
||||||
cgInPlaceEditor.OnExit := EndEdit;
|
cgInPlaceEditor.Parent := self;
|
||||||
|
cgInPlaceEditor.OnExit := EndEdit;
|
||||||
|
end;
|
||||||
|
cgInplaceEditor.Show;
|
||||||
|
|
||||||
{ edit address }
|
{ edit address }
|
||||||
if field = 'Address' then begin
|
if field = 'Address' then begin
|
||||||
@ -2380,7 +2393,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FreeAndNil(cgInPlaceEditor);
|
cgInplaceEditor.Hide;
|
||||||
|
// FreeAndNil(cgInPlaceEditor);
|
||||||
|
|
||||||
if FActiveContact.Changed then begin
|
if FActiveContact.Changed then begin
|
||||||
DataStore.PostContacts;
|
DataStore.PostContacts;
|
||||||
@ -2525,7 +2539,7 @@ begin
|
|||||||
|
|
||||||
{ for simplicity, bail out of editing while scrolling. }
|
{ for simplicity, bail out of editing while scrolling. }
|
||||||
EndEdit(Self);
|
EndEdit(Self);
|
||||||
if cgInPlaceEditor <> nil then
|
if cgInplaceEditor.Visible then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
case Msg.ScrollCode of
|
case Msg.ScrollCode of
|
||||||
|
Reference in New Issue
Block a user