🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2567

Re: Dynamically creating control elements

#2567
From: JD
Date: Wed, 14 Feb 2007 23:22
36 lines
1924 bytes
Jos� <jose@127.0.0.1> wrote:
>
> [...] I thought "new TEdit"

If you intend to use access the control after it's been
allocated, then you'll need to define a pointer for it
somewhere:

    private:
        TEdit *MyEdit;

then you need to allocate it and assign some properties:

    MyEdit = new TEdit( this );
    MyEdit->Parent = this;
    MyEdit->Left = 10;
    MyEdit->Top = 10;
    // set other properties as needed

Note that when it's allocated, an Owner is assigned and when
an object has an Owner, you need not worry about deleting it
because that's what the Owner is for. The Parent is where the 
control will live on-screen. For example, the 'this' pointer
referes to the class from which it's used and the TForm is
assumed here so the result will be a TEdit at (10,10).

For objects that do not have an Owner, you need to manually
destroy them before the application terminates. For example:

    delete MyEdit;

To be clear, even if the objects has an Owner, you can still
manually delete it.

~ JD
Technical Details
Message-ID: <45d399bc$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <rn57t2pmf8uea6jvdqsk043nabb65gqoo4@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,81ef9a10230b5c55
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: Dynamically creating control elements
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 205.188.116.136     
X-Forwarded-For: 172.128.135.73
References:  <rn57t2pmf8uea6jvdqsk043nabb65gqoo4@4ax.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <45d399bc$1@newsgroups.borland.com>
Date: 14 Feb 2007 15:22:36 -0800
X-Trace: newsgroups.borland.com 1171495356 207.105.83.66 (14 Feb 2007 15:22:36 -0800)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail