John Kelley
April 12th, 1999, 11:41 PM
I know how to open dialogs, etc., from a menu option, but I can't seem to even get started with a record view. From MainFrm.cpp (which is where I have placed the menu selector) I try the following:
void CMainFrame::OnViewInventory()
{
CMyRecordView hInventoryView;
}
ERROR! I can't even declare an item of this class because the constructor is protected due to the need for dynamic creation.
Not to be deterred, I dutifully looked up how to dynamically create objects and tried the following:
void CMainFrame::OnViewInventory()
{
CRuntimeClass* pRuntimeClass = RUNTIME_CLASS( CMyRecordView );
CObject* pObject = pRuntimeClass->CreateObject();
ASSERT( pObject->IsKindOf( RUNTIME_CLASS( CMyRecordView ) ) );
}
Great, no errors! But still nothing happens when I select the menu item for this process. So, how do I create this CRecordView?
Thanks for any help!
John
----
"Try not. Do, or do not. There is no try." - Yoda
void CMainFrame::OnViewInventory()
{
CMyRecordView hInventoryView;
}
ERROR! I can't even declare an item of this class because the constructor is protected due to the need for dynamic creation.
Not to be deterred, I dutifully looked up how to dynamically create objects and tried the following:
void CMainFrame::OnViewInventory()
{
CRuntimeClass* pRuntimeClass = RUNTIME_CLASS( CMyRecordView );
CObject* pObject = pRuntimeClass->CreateObject();
ASSERT( pObject->IsKindOf( RUNTIME_CLASS( CMyRecordView ) ) );
}
Great, no errors! But still nothing happens when I select the menu item for this process. So, how do I create this CRecordView?
Thanks for any help!
John
----
"Try not. Do, or do not. There is no try." - Yoda