|
-
May 11th, 1999, 04:14 PM
#1
Help with some misc things
I am playing around with VC++, and I would like to make a single doccument aplication .. I have played around with dialog based ones. Anyways I cant figure out how to get controls to appear in the SDI ... any help / examples would be appricated.
-
May 11th, 1999, 06:09 PM
#2
Re: Help with some misc things
Controls are added easily to dialog boxes by creating them with a resource editor and storing them in a resource file (.rc). There's no such equivalent for windows. If you want controls to appear in your sdi window, then you need to create them dynamically. The way to do this is as follows:
0. Derive a window class from CWnd.
1. add a data member variable for each control you want.
2. These control data members will be default contructed automatically by the window constructor.
3. In the window's OnCreate() member function, call each control's Create() or CreateEx() member function, depending on the styles you want the controls to have.
sample code:
class MyWindow : public CWnd
{
public:
int OnCreate( LPCREATESTRUCT lpCreateStruct );
private:
CButton my_button_;
CStatic my_static_;
}
My_Window::OnCreate()
{
my_button.Create(/* various parameters */);
my_static. Create(/* various parameters */);
}
-
May 12th, 1999, 12:45 AM
#3
Re: Help with some misc things
Try changing the base class of your view class to CFormView. This simplifies adding controls to your applications main view window.
-
May 12th, 1999, 05:52 PM
#4
Thanks.
Thanks for the help, this will make a few of my programming attempts a bit easier =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|