From: <ah...@us...> - 2009-04-16 16:28:52
|
Revision: 12276 http://jvcl.svn.sourceforge.net/jvcl/?rev=12276&view=rev Author: ahuser Date: 2009-04-16 16:28:41 +0000 (Thu, 16 Apr 2009) Log Message: ----------- - Fixed memory leak - The EditButton now updates the EditCtrl content - EditCtrl.OnExit now catches the exception, show it and sets the focus back to the EditCtrl Modified Paths: -------------- trunk/jvcl/run/JvInspector.pas Modified: trunk/jvcl/run/JvInspector.pas =================================================================== --- trunk/jvcl/run/JvInspector.pas 2009-04-15 19:30:15 UTC (rev 12275) +++ trunk/jvcl/run/JvInspector.pas 2009-04-16 16:28:41 UTC (rev 12276) @@ -5470,6 +5470,8 @@ procedure TJvCustomInspectorItem.ButtonClick(Sender: TObject); begin Edit; + if EditCtrl <> nil then + EditCtrl.Text := DisplayValue; end; function TJvCustomInspectorItem.CanEdit: Boolean; @@ -5719,22 +5721,26 @@ procedure TJvCustomInspectorItem.EditFocusLost(Sender: TObject); begin if Inspector.HandleAllocated and not Inspector.Focused then + begin + // Mantis 3391: When the focus is lost, the editing is finished, so that + // moving to another item or another control always updates the value. + try + Apply; + except + Application.HandleException(Self); + if (EditCtrl <> nil) and EditCtrl.CanFocus then + EditCtrl.SetFocus; + end; + InvalidateItem; + Inspector.Invalidate; + end; end; procedure TJvCustomInspectorItem.EditKillFocus(Sender: TObject); begin if DroppedDown then CloseUp(False); - - // Mantis 3391: When the focus is lost, the editing is finished, so that - // moving to another item or another control always updates the value. - - // Don't ever call DoneEdit() here because it will destroy the EditCtrl in - // whos event handler we are at the moment. And we don't want to destroy - // the EditCtrl anyway. - Apply; - InvalidateItem; end; procedure TJvCustomInspectorItem.AutoCompleteStart(Sender: TObject); @@ -6315,8 +6321,7 @@ end; end; -procedure TJvCustomInspectorItem.MouseUp(Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); +procedure TJvCustomInspectorItem.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var WasPressed: Boolean; begin @@ -10213,8 +10218,8 @@ begin for I := High(FItems) downto Low(FItems) do Items[I].Free; - if FRegistered then - DataRegister.Remove(Self); + if FRegistered and (GlobalDataRegister <> nil) then + DataRegister().Remove(Self); inherited BeforeDestruction; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |