Solved

Dynamic Controls

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 58
Separate into files by filename 12 87
VBA "SendKeys" Syntax for Multiple Keystrokes 7 117
Window placement 17 87
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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