|
-
April 13th, 1999, 06:30 PM
#1
Creating a CRecordView dynamically?
When I create an application based on CEditView, I can't seem add a CRecordView as an option. From Mainfrm.cpp, I try to add a menu option to create a new CRecordView, but if I try to even declare an object of this type, I get an error indicating that the Constructor (the Destructor is, too) is protected. So, I found out that CRecordView is a runtime class, but how do I create it?
void CMainFrame::OnMyRecordView()
{
}
What do I put in this function if I can't create an object of type CRecordView?
Thanks for any help!
"Try not. Do, or do not. There is no try." - Yoda
-
April 14th, 1999, 02:30 AM
#2
Re: Creating a CRecordView dynamically?
Do you want to create an additional view?
in InitInstance register another doc template with the RecordView view class
then call CreateNewFrame with doc pointer set to current document.
Otherwise you would have to dynamically create the object through the runtime class...
hope this offers some help...
(just do it)
chrislaw
-
April 14th, 1999, 10:24 AM
#3
Re: Creating a CRecordView dynamically?
In that case, I guess my question is how do I dynamically create the object through the runtime class? In the online help, I found the following:
void CMainFrame::OnViewInventory()
{
CRuntimeClass* pRuntimeClass = RUNTIME_CLASS( CMyRecordView );
CObject* pObject = pRuntimeClass->CreateObject();
ASSERT( pObject->IsKindOf( RUNTIME_CLASS( CMyRecordView ) ) );
}
But using just this code does not bring up the view. However, I still cannot use CMyRecordView to declare an oject, and CObject doesn't seem to do anything, either.
Any suggestions?
Thanks again!
"Try not. Do, or do not. There is no try." - Yoda
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
|