Jump to content

Dynamic creation of components


Mediv

Recommended Posts

Hi Farhad, need to dynamically create a component, there is a problem with the creation of Label,Edit component.

Attached a test project, if the method uses its DynamicForm.CreateTUniLabel label created!

If DynamicForm.ConstructionForm (5, 'Metka') there are problems, the result of the screenshot.

I apologize in advance for the version I am using Delphi 2007, Build 943, there is no facility to upgrade.

I think the problem is not connected with the version uniGui. Maybe the problem is a variable of type TUniControl.

Thank you.

TestDinamic - ?????.zip

post-475-0-10868300-1339223184_thumb.png

post-475-0-99623900-1339223190_thumb.png

post-475-0-72245400-1339223201_thumb.png

post-475-0-98719600-1339223208_thumb.png

Link to comment
Share on other sites

  • Administrators

You can't create a Form dynamically and then refer to its "static" instance.

 

Creating a dynamic form doesn't initialize its reference as we define as:

 

function DynamicForm: TDynamicForm;

 

Calling DynamicForm() inside a dynamically created form will create a 2nd instance.

 

 

Corrected:

 

	Metka : begin
         	pComponent  	:= Self.CreateTUniLabel;
         	pComponent.Tag  := 1;
       	end;

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...