From: Marcel B. <jed...@us...> - 2004-04-23 08:31:19
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17543/dev/JVCL3/run Modified Files: JvInspector.pas Log Message: Mantis 1652: Added OnItemValueError event Index: JvInspector.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvInspector.pas,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** JvInspector.pas 17 Apr 2004 18:27:07 -0000 1.85 --- JvInspector.pas 23 Apr 2004 08:31:09 -0000 1.86 *************** *** 26,29 **** --- 26,33 ---- RECENT CHANGES: + Apr 23, 2004, Marcel Bestebroer: + - Added OnItemValueError event, which is fired when an exception occurs + during the Item's Apply method. If no handler is assigned, the + exception will be raised, otherwise the event handler is called. Apr 16, 2004, Marcel Bestebroer: - Fixed an issue regarding resizable items or items with non-default *************** *** 268,271 **** --- 272,277 ---- TJvInspConfKeyEvent = procedure(const SectionName: string; var ItemName: string; var ATypeInfo: PTypeInfo; var Allow: Boolean) of object; + TInspectorValueErrorEvent = procedure(Sender: TObject; Item: TJvCustomInspectorItem; + ExceptObject: Exception) of object; EJvInspector = class(EJVCLException); *************** *** 335,338 **** --- 341,345 ---- FOnEditorMouseDown: TOnJvInspectorMouseDown; FOnItemEdit : TOnJvInspectorItemEdit; + FOnItemValueError: TInspectorValueErrorEvent; FInspectObject: TObject; *************** *** 359,362 **** --- 366,370 ---- procedure DoItemSelected; virtual; procedure DoItemValueChanged(const Item: TJvCustomInspectorItem); virtual; + function DoItemValueError(Item: TJvCustomInspectorItem): Boolean; virtual; function GetAfterDataCreate: TInspectorDataEvent; virtual; function GetAfterItemCreate: TInspectorItemEvent; virtual; *************** *** 494,497 **** --- 502,506 ---- property OnEditorMouseDown: TOnJvInspectorMouseDown read FOnEditorMouseDown write FOnEditorMouseDown; property OnItemEdit : TOnJvInspectorItemEdit read FOnItemEdit write FOnItemEdit; + property OnItemValueError: TInspectorValueErrorEvent read FOnItemValueError write FOnItemValueError; public constructor Create(AOwner: TComponent); override; *************** *** 547,551 **** property OnItemSelected; property OnItemValueChanged; ! property OnItemEdit; // NEW! // Standard control events --- 556,561 ---- property OnItemSelected; property OnItemValueChanged; ! property OnItemValueError; ! property OnItemEdit; // Standard control events *************** *** 2636,2639 **** --- 2646,2661 ---- end; + function TJvCustomInspector.DoItemValueError(Item: TJvCustomInspectorItem): Boolean; + var + E: Exception; + begin + Result := True; + E := ExceptObject as Exception; + if Assigned(FOnItemValueError) then + OnItemValueError(Self, Item, E) + else + Result := False; + end; + function TJvCustomInspector.GetAfterDataCreate: TInspectorDataEvent; begin *************** *** 5161,5165 **** if Editing and (EditCtrl <> nil) and (not Data.IsAssigned or (DisplayValue <> EditCtrl.Text)) then begin ! DisplayValue := EditCtrl.Text; InvalidateItem; if EditCtrl <> nil then --- 5183,5192 ---- if Editing and (EditCtrl <> nil) and (not Data.IsAssigned or (DisplayValue <> EditCtrl.Text)) then begin ! try ! DisplayValue := EditCtrl.Text; ! except ! if not Inspector.DoItemValueError(Self) then ! raise; ! end; InvalidateItem; if EditCtrl <> nil then *************** *** 6839,6843 **** if not CancelEdits and (not Data.IsAssigned or (DisplayValue <> EditCtrl.Text)) then begin ! DisplayValue := EditCtrl.Text; InvalidateItem; end; --- 6866,6871 ---- if not CancelEdits and (not Data.IsAssigned or (DisplayValue <> EditCtrl.Text)) then begin ! Apply; ! // DisplayValue := EditCtrl.Text; InvalidateItem; end; |