Solved

Dynamic Controls

Posted on 2000-04-20
2
153 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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

690 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