Domanda

2 things are my problem

1) a have a TMyframe=class(TFrame) defined in a package, but this frame is not listed in the frame palette. So I registered my class from a designtime package using several methods none of which appeared to do what I want. (RegisterCOmponent, RegisterClass and RegisterCustomModule)

2) The biggest problem since Delphi does not 'know' my frame, it is handled as a regular component, and when using it inline, the (sub) objects defined in it appear in the form resource as 'object' rather than 'inherited' causing 'object blahblah already exists' when the form is created later on. The same behaviour happens in the IDE's form designer. When I move this frame unit from my runtime components package to the main module (my "kernel" bpl) then object/inherited problem is gone, and everything appears to work normally. Probably because knows how to resolve "TMyCustomFrame".

So... How can I define frames in one package and use them in forms (in other packages or exe) during designtime without delphi messing up my form resource.

Using XE5, Update1, VCL

(I will have come up with some simple example, meanwhile I already wanted the question out there)

TIA

È stato utile?

Soluzione

From the documentation, it appears that this is not possible (emphasis added):

Adding frames to the Tool Palette

Frames are added to the Tool Palette as component templates. To add a frame to the Tool Palette, open the frame in the Form Designer (you cannot use a frame embedded in another component for this purpose), right-click the frame, and choose Add to Palette. When the Component Template Information dialog box opens, select a name, a palette page, and an icon for the new template.

It appears to be confirmed here:

Sharing Frames

You can share a frame with other developers in two ways:

Add the frame to the Object Repository.

Distribute the frame's unit (.pas) and form (.dfm or .fmx) files.

To add a frame to the Object Repository, open any project that includes the frame, right-click the Form Designer, and choose Add to Repository. For more information, see Using the Object Repository.

If you send a frame's unit and form files to other developers, they can open the files and add the frames and forms to the Tool Palette. If the frame has other frames embedded in it, it can only be opened as part of a project.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top