?
Solved

Dynamic Controls

Posted on 2000-04-20
2
Medium Priority
?
154 Views
Last Modified: 2013-11-20
Hi,

I have an application, in my i want create the control dynamically (button and edit) how to create the same?  if send me a piece of code that will  help me continue with my application.


bye
Arora
0
Comment
Question by:Arora
[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
2 Comments
 
LVL 8

Accepted Solution

by:
VinExpert earned 150 total points
ID: 2737044
Hi,

Do like this.
Have the CButton or CEdit pointers in the .h file for that class as
CEdit *m_edit;
CButton *m_button;

In the constructor do
m_edit = NULL;
m_button = NULL;

When creating
m_edit->Create(WS_VISIBLE | ES_LEFT | WS_CHILD, CRect(10,10,100,100), this, 4545);
m_edit->ShowWindow(SW_SHOW);

m_button->Create("Hi", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, CRect(110,110, 150, 150), this, 5555);
m_button->ShowWindow(SW_SHOW);

Here I have given some co-ords and id. U can specify them.

Hope this helps.
VinExpert
0
 

Author Comment

by:Arora
ID: 2741778

Thank you, but it will not work untill  you make the following change
 in constructor
m_edit =(CEdit*) new CEdit;
   m_button =(CButton*) new CButton;


bye
arora
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

765 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