Solved

Dynamic Controls

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 122
Process filename extension 3 156
ffmpeg - "rtsp://...... Operation not permitted" 4 68
twoTwo  challenge 35 86
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‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now