🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Create VCL Control from within an Object

#544
From: Asger Joergensen
Date: Thu, 31 Jan 2008 14:09
44 lines
2356 bytes
Hi JohnC 
 
 JohnC says:
> I have some fairly complicated arrangements of VCL controls on some forms 
> and I have been trying (unsuccessfully) to create an object which I can add 
> to a form to automatically add the items along with the code that I need for 
> their interaction to the form when the form is created.  I would like to 
> hide all the details of their operation and interaction since they would be 
> common for all uses.  I don't especially need to see the objects during 
> design time - I was planning on just putting a panel where the items would 
> go.
> 
> Is this possible?

If I understand You correctly, that shouldn't be a problem, but
please explain what kind of object, what kind of items.

You can create VCL components by using the keyword new, but
if You want them to be visible You have to provide a Parent.


void __fastcall TYourClass::ButtonClick(TObject *Sender)
{
}
//-----------------------------------------------------


TButton *Button = new TButton(NULL); //You must delete
or
TButton *Button = new TButton(Form1); // deleted automaticly
Button->SetBounds(10,10, 150, 23);
Button->Parent = Panel2;
Button->OnClick = ButtonClick;

If You provide the owner the component is deletet by the owner
but if You don't need it anymore You can still delete it You self
like You have to if You dont provide the owner.

P.s. questions like this are better asked in: 
borland.public.cppbuilder.vcl.components.using

Kind regards
Asger
Technical Details
Message-ID: <MPG.220bf5123600e831989a26@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <47a1c92f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,15058af8c1208ee6
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Asger Joergensen <junk@Asger-P.dk>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Create VCL Control from within an Object
Date: Thu, 31 Jan 2008 15:09:46 +0100
Message-ID: <MPG.220bf5123600e831989a26@newsgroups.borland.com>
References: <47a1c92f$1@newsgroups.borland.com>
Organization: Asger-P
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
NNTP-Posting-Host: 83.73.220.89
X-Trace: newsgroups.borland.com 1201788706 83.73.220.89 (31 Jan 2008 06:11:46 -0700)
Lines: 44
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail