diff --git a/fcl/inc/classes.inc b/fcl/inc/classes.inc index 767bd9fc0d..e06826dd18 100644 --- a/fcl/inc/classes.inc +++ b/fcl/inc/classes.inc @@ -72,9 +72,14 @@ var { TBasicAction implementation } {$i action.inc} +{ TDataModule implementation } +{$i dm.inc} + { Class and component registration routines } {$I cregist.inc} + + { Interface related stuff } {$ifdef HASINTF} {$I intf.inc} @@ -266,42 +271,58 @@ begin Result := True; end; +Type + TInitHandler = Class(TObject) + AHandler : TInitComponentHandler; + AClass : TComponentClass; + end; + +Var + InitHandlerList : TList; + +procedure RegisterInitComponentHandler(ComponentClass: TComponentClass; Handler: TInitComponentHandler); + +Var + I : Integer; + H: TInitHandler; + +begin + If (InitHandlerList=Nil) then + InitHandlerList:=TList.Create; + H:=TInitHandler.Create; + H.Aclass:=ComponentClass; + H.AHandler:=Handler; + With InitHandlerList do + begin + I:=0; + While (I TComponent) and (ClassType <> RootAncestor) then - begin - { Init the parent class first } - Result := DoInitClass(ClassType.ClassParent); - - { !!!: This would work only on Win32, how should we do this multiplatform? - Result := InternalReadComponentRes(ClassType.ClassName, - FindResourceHInstance(FindClassHInstance(ClassType)), Instance) - or Result;} - Result := False; - end; - end; +Var + I : Integer; begin - {!!!: GlobalNameSpace.BeginWrite; - try} - if (Instance.ComponentState * [csLoading, csInline]) = [] then + I:=0; + Result:=False; + With InitHandlerList do begin - BeginGlobalLoading; - try - Result := DoInitClass(Instance.ClassType); - NotifyGlobalLoading; - finally - EndGlobalLoading; + I:=0; + // Instance is the normally the lowest one, so that one should be used when searching. + While Not result and (I