Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Packages/Package Manager    [ Add a report in this area ]  
Report #:  66049   Status: Reported
RegisterComponents() prevents initialization of package on IDE load, preventing initialization section usage.
Project:  Delphi Build #:  11.0.2902.10471
Version:    11.2 Submitted By:   Thomas Koos
Report Type:  Basic functionality failure Date Reported:  8/25/2008 7:21:44 AM
Severity:    Commonly encountered problem Last Updated: 8/25/2008 7:23:57 AM
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Calling the RegisterComponents() function in the Register function of a unit in a package will prevent the execution of the initialization section of other units of that package.

Basic problem: I have a package containing two units:

1. a TGraphic descendant implementing a new graphic format
2. a component using the new graphic format.

The problem: The TGraphic descendant was not listed in the TOpenPictureDialog of the TImage.Picture property in the IDE at design time. The only exception is direct after installing the packages. Just closing the IDE and restart it will loose the TGraphic descendant. The package itself is correctly loaded, the component out of the packages is correctly installed and usable, but the TGraphic descendant will not.
Steps to Reproduce:
I included a complete projectgroup showing the problem. Because the initialization section should not be used to call WinAPI functions with UI interaction, I used the OutputDebugString() function. You can view the output of this function with the help DebugView by Mark Russinovich (see http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx for details & free download).

The file details

I have a project group (pkgGroup.groupproj) containing two designtime packages. One without an additional component and one without a component.

The component (TestComponent.pas) is a simple descendant of TComponent implementing nothing just logging the calls to Initialization, Finalization and Register. The Register function calls RegisterComponents() to register the component in the IDE.

Both packages containing another unit (TestUnit_1.pas & TestUnit_2.pas). Both units containing the same source, just the identifier differ to help reading the log output. Both units also log the calls to Initialization, Finalization and Register.

Expected output in the DebugView is:

Call to Initialization & Register of TestUnit_1, TestUnit_2 and TestComponent.

Actual output:

Call to Intitilization & Register of TestUnit_1



The call to the Initialization & Register function of TestUnit_2 and TestComponent will occur when using the component in the IDE. The problem is, that the graphic registration will never be called if you not use the component of the package.
Workarounds
Seperate the components from the self registering units in different packages.
Attachment
QC66049.zip
Comments

None

Server Response from: ETNACODE01