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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...