Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add buttons & sliders automatically

Status
Not open for further replies.

Jaredino

Technical User
Jan 31, 2006
17
GB
Hi,
I have created a new SDI project which is a formview and have added a number of buttons and sliders in a group box. Does anyone know how I can add a copy of this layout to the form when the user clicks the appropraite button on the toolbar?

Any help would be appreciated, thanks
 
I would suggest you progamatically create these controls using their create function.

You can place these created controls where you like on your form.

Code:
CButton* pButton;
CRect rectPlacement;

pButton->Create(strCaption, BS_FLAT, rectPlacement, this, IDC_YOURID);

Hope this helps.
 
oh forgot to say, remember to show the new control using

Code:
pButton->ShowWindow(SW_SHOWNORMAL);
 
Thanks. So do I place all the code in the toolbar buttons onClick() function? (I am guessing not since it causes the program to crash) Sorry I am new to this
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top