Board index » delphi » Creating objects during runtime

Creating objects during runtime

Greetings everyone:

I've been having problem creating object during runtime, but I'm having
quite a bit of problem here.  What I'm trying to do is to create an object
WITHIN a TTabSheet of a TPageControl.  I want to create a TMemo, a TEdit,
and a TButton, but for some reason it never works for me.  Does anyone know
the secret to this?  If you do, can you please teach me?  Thanks!

Thomas

Here is my code so far, and it won't work... =(
I could only create the TabSheet, I can never see the Memo, and same for
TEdit and TButton

            with TTabSheet.Create(Chat_Channel) do
            begin
               PageControl := Chat_Channel;
               Name := Target;
               Caption := Target;
            showmessage(inttostr(Chat_Channel.PageCount-1));
            end;

// from HERE I'm Lost

            with Chat_Channel.Pages[Chat_Channel.PageCount-1]
            do begin
                  with TButton.Create(Private_Dialog)
                  do begin
                        PageControl := Chat_Channel;
                        Name := 'adf';
                        Width := 1000;
                        Height := 1000;
                        Left := 0;
                        Top := 0;
                        Visible := True;
                     end;
                  with TButton.Create(Private_Send)
                  do begin
                        Width := 1000;
                        Height := 1000;
                        Caption := 'WHY THE F WONT THIS WORK??';
                        Top := 0;
                        Left := 0;
                        Visible := True;
 //                    dolog('button left: ' + inttostr(left) + ' top: ' +
inttostr(top));
//                        dolog('button height: ' + inttostr(height) + '
width: ' + inttostr(width));
                     end;
                  with TEdit.Create(Private_Edit)
                  do begin
                        Width := 1024;
                        Text := 'Uh huh...';
                        Top := 20;
                        Left := 20;
                        Visible := True;
                     end;
               end;

 

Re:Creating objects during runtime


"Simon Devlin" <simon.dev...@kremlin-computing.com> skrev i en meddelelse
news:3e6efd15@newsgroups.borland.com...

Quote
> Not sure this is the correct group for this post, but I suspect you need
to
> look at the .owner property of the child control.#

...and the Parent property.
The Owner is responsible for destroying the object. If there's no owner then
you must destroy it your self.
The Parent is responsible for visualizing the object.

Regards
Lars B.

-- ----------------------------
http://www.dvd-a.dk/

Re:Creating objects during runtime


Not sure this is the correct group for this post, but I suspect you need to
look at the .owner property of the child control.#

Quote
"Thomas" <thomasch...@shaw.ca> wrote in message

news:3e6ef7f6$1@newsgroups.borland.com...
Quote
> Greetings everyone:

> I've been having problem creating object during runtime, but I'm having
> quite a bit of problem here.  What I'm trying to do is to create an object
> WITHIN a TTabSheet of a TPageControl.  I want to create a TMemo, a TEdit,
> and a TButton, but for some reason it never works for me.  Does anyone
know
> the secret to this?  If you do, can you please teach me?  Thanks!

> Thomas

Re:Creating objects during runtime


Thanks guys, this phrase really lightened me up... I worked my way up from
making the object from the form to making it within the sheet, which is
exactly what i want =D

Quote
> The Owner is responsible for destroying the object. If there's no owner
then
> you must destroy it your self.
> The Parent is responsible for visualizing the object.
"LB" <L...@BL.LB> wrote in message news:3e6efeb7@newsgroups.borland.com...
> "Simon Devlin" <simon.dev...@kremlin-computing.com> skrev i en meddelelse
> news:3e6efd15@newsgroups.borland.com...
> > Not sure this is the correct group for this post, but I suspect you need
> to
> > look at the .owner property of the child control.#

> ...and the Parent property.
> The Owner is responsible for destroying the object. If there's no owner
then
> you must destroy it your self.
> The Parent is responsible for visualizing the object.

> Regards
> Lars B.

> -- ----------------------------
> http://www.dvd-a.dk/

Re:Creating objects during runtime


Err, actually that was the one I meant...  Still, glad to see I wasn't
totally wrong :-)

Quote
"LB" <L...@BL.LB> wrote in message news:3e6efeb7@newsgroups.borland.com...

> ...and the Parent property.
> The Owner is responsible for destroying the object. If there's no owner
then
> you must destroy it your self.
> The Parent is responsible for visualizing the object.

Other Threads