Jump to content

gatosoft

Members
  • Posts

    2
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by gatosoft

  1. Hi ElGringo,

    Firts to all, sorry for my english, i'll try to explain me.

    1) You have a component into your Test Program... this INSTANCE is named SomeComponent1 and his SomeValue property its set to "123"
    2) When you call the CreateAdditionalForm Method, you delcare a new variable of TSomecomponent class, and you INSTANCES A NEW OBJECT
    3) When you call ShowMessage, you pass the New INSTANCE recently created, which SomeValue property is empty.

    I suggest:

    1) Delete the OnCreate Method from your TAdditional Form
    2) Create a New Private variable FSomeComponent
    3) Create a overload constructor for this form,like this:
     

      TfAdditional = class(TForm)
      private
        { Private declarations }
        FSomeComponent: TSomeComponent;
      public
        { Public declarations }
        Constructor Create(aSomeComponent: TSomeComponent);
      end;

     
    4) Implement it, like this:
     

    constructor TfAdditional.Create(aSomeComponent: TSomeComponent);
    begin
      inherited Create(Application);
      FSomeComponent:= aSomeComponent;
      ShowMessage(FSomeComponent.SomeField);
    end;

     

    In this way, when you creates this Form, pass the Component "parent"

    5) Finally, into the CreateAdditionalForm method write this:

    procedure TSomeComponent.CreateAdditionalForm;
    
    var AdditionalForm:TfAdditional;
    
    begin
    
        AdditionalForm:=TfAdditional.Create(Self);
    
    end;


    I hope I have understood and solved your problem,

     

    (again, sorry for my english)

    Bye

    Gatosoft

    • Upvote 1
×
×
  • Create New...