?
Solved

Adding an object to a form at runtime

Posted on 1998-07-23
4
Medium Priority
?
175 Views
Last Modified: 2010-04-04
First off I'm using C++ builder 3... similar to Delphi ... so any delphi code will help me ...I'd post my question in C++ section, but since it's a VCL thing, you guys are probably my best source.

I want to add a DriveComboBox to a form at run time.

After declaring a pointer variable to the object, and creating the object... I can access it's properties, but I can't see it on my form.... Is there a way to do this??

my code in C++ is

TDriveComboBox *Dr1;

Dr1 = new TDriveComboBox(Form1);

....
now properties can be accessed...
but DriveComboBox is NOT visible on the form
0
Comment
Question by:rafy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 1

Accepted Solution

by:
arh earned 200 total points
ID: 1358576
You should do this just after creating your control:
Dr1.parent:=Form1;
0
 
LVL 1

Expert Comment

by:arh
ID: 1358577
sorry, it was Delphi syntax..
Dr1.Parent=Form1; // right?
0
 

Author Comment

by:rafy
ID: 1358578
Dr1->Parent = Form1;
to be exact...

Perfect, thanks.

By the way, do I have to free the memory that I allocated for this object, or will the form automatically do the clean up for me when I close it.
0
 
LVL 1

Expert Comment

by:arh
ID: 1358579
Owner (which you give as an argument to constructor call) will always destroy
component object.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question