TApplication now sets FindGlobalComponent always

git-svn-id: trunk@7497 -
This commit is contained in:
mattias 2005-08-13 11:11:17 +00:00
parent a7cd638873
commit f747f8fec6
3 changed files with 15 additions and 3 deletions

View File

@ -670,6 +670,7 @@ begin
DoFinishReading;
finally
UnregisterFindGlobalComponentProc(@MyFindGlobalComponent);
Application.FindGlobalComponentEnabled:=true;
if DestroyDriver then Reader.Driver.Free;
Reader.Free;
end;
@ -697,6 +698,7 @@ begin
Reader:=CreateLRSReader(BinStream,DestroyDriver);
MyFindGlobalComponentProc:=@OnFindGlobalComponent;
RegisterFindGlobalComponentProc(@MyFindGlobalComponent);
Application.FindGlobalComponentEnabled:=false;
{$IFDEF VerboseJITForms}
writeln('[TJITComponentList.InitReading] A');
@ -867,6 +869,7 @@ begin
DoFinishReading;
finally
UnregisterFindGlobalComponentProc(@MyFindGlobalComponent);
Application.FindGlobalComponentEnabled:=true;
if DestroyDriver then Reader.Driver.Free;
Reader.Free;
end;

View File

@ -857,6 +857,7 @@ type
private
FApplicationHandlers: array[TApplicationHandlerType] of TMethodList;
FCaptureExceptions: boolean;
FFindGlobalComponentEnabled: boolean;
FFlags: TApplicationFlags;
FHint: string;
FHintColor: TColor;
@ -997,6 +998,8 @@ type
procedure DoTabKey(AControl: TWinControl; var Key: Word;Shift: TShiftState);
property CaptureExceptions: boolean read FCaptureExceptions
write SetCaptureExceptions;
property FindGlobalComponentEnabled: boolean read FFindGlobalComponentEnabled
write FFindGlobalComponentEnabled;
//property HelpSystem : IHelpSystem read FHelpSystem;
property Hint: string read FHint write SetHint;
property HintColor: TColor read FHintColor write SetHintColor;

View File

@ -27,7 +27,10 @@ const
function FindApplicationComponent(const ComponentName: string): TComponent;
begin
Result:=Application.FindComponent(ComponentName);
if Application.FindGlobalComponentEnabled then
Result:=Application.FindComponent(ComponentName)
else
Result:=nil;
end;
function GetHintControl(Control: TControl): TControl;
@ -93,6 +96,8 @@ begin
ApplicationActionComponent:=Self;
OnMenuPopupHandler:=@MenuPopupHandler;
FFindGlobalComponentEnabled:=true;
RegisterFindGlobalComponentProc(@FindApplicationComponent);
inherited Create(AOwner);
CaptureExceptions:=true;
@ -132,6 +137,9 @@ begin
for HandlerType:=Low(TApplicationHandlerType) to High(TApplicationHandlerType)
do
FreeThenNil(FApplicationHandlers[HandlerType]);
UnregisterFindGlobalComponentProc(@FindApplicationComponent);
inherited Destroy;
Include(FFlags,AppDoNotReleaseComponents);
@ -1414,7 +1422,6 @@ begin
// events and constructors can refer to it
TComponent(Reference) := Instance;
RegisterFindGlobalComponentProc(@FindApplicationComponent);
ok:=false;
try
Instance.Create(Self);
@ -1422,7 +1429,6 @@ begin
finally
if not ok then
TComponent(Reference) := nil;
UnregisterFindGlobalComponentProc(@FindApplicationComponent);
end;
if (Instance is TForm) then begin