Form View in a Tab |
Post Reply |
Author | |
almatesic
Newbie Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
Posted: 29 December 2005 at 12:05pm |
Hi! I've been messing around with this for a few days now and I can't seem to get the form to view in my tab. I understand that we are using the FormView::Create but I don't know what I seem to be missing. Below is the snippet of the code i am using. .cpp if (!m_accountsview.Create(NULL, NULL, WS_CHILD|WS_VISIBLE,CRect(0,0,0,0), this, IDC_ACCOUNTS_VIEW, NULL)){ TRACE0("Failed to create Accounts View control.\n"); return -1;}
These are the errors I am recieving when building the project. TabbedViewView.cpp c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\TabbedViewView.cpp(48) : error C2248: 'CAccountsView::CAccountsView' : cannot access protected member declared in class 'CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\AccountsView.h(12) : see declaration of 'CAccountsView::CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\AccountsView.h(7) : see declaration of 'CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\TabbedViewView.cpp(55) : error C2248: 'CAccountsView::~CAccountsView' : cannot access protected member declared in class 'CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\AccountsView.h(13) : see declaration of 'CAccountsView::~CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\AccountsView.h(7) : see declaration of 'CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\TabbedViewView.cpp(135) : error C2248: 'CFormView::Create' : cannot access protected member declared in class 'CFormView' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxext.h(800) : see declaration of 'CFormView::Create' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxext.h(749) : see declaration of 'CFormView'
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, Just read what Visual Studio write: error C2248: 'CAccountsView::CAccountsView' : cannot access protected member declared in class 'CAccountsView' It means that constructor of CAccountsView declared in "protected" section, replace it to "public" etc. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
almatesic
Newbie Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Hi! The other problem was solved. But now i have this problem. I figured it was the same issue as the other one and I tried to do numberous things so it would be able to access the member that is declared in the class 'CFormView', but everything I appreciate all your help. TabbedViewView.cpp c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\TabbedViewView.cpp(135) : error C2248: 'CFormView::Create' : cannot access protected member declared in class 'CFormView' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxext.h(800) : see declaration of 'CFormView::Create' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxext.h(749) : see declaration of 'CFormView' |
|
almatesic
Newbie Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Here are the things that I've tried doing: 1) CTabbedViewView::CTabbedViewView() { // TODO: add construction code herem_iHitTest = -1; m_nIDEvent = 20; } but that didn not work. 2) I tried making the class public in afxext.h |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, as you can see Create in CFormView declared as protected As workaround you can add same Create method in CTabbedViewView but public and call base method in it. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
almatesic
Newbie Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Hello and Hope you had a pleasant New Years. I went ahead and created the same Create method in the TabbedViewView.h file and placed it in the public area as so. // Implementation public :virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext); void UpdateTabBorders(); virtual ~CTabbedViewView();and I don't know if i'm calling the base class in the correct way. This is how I am doing it. If I remove the CTabbedViewView, it then seems to still be pulling the create function from CFormView but it isn't now. // Create the Accounts View control for the resource tab if (!m_accountsview.CTabbedViewView::Create(NULL, NULL, WS_CHILD|WS_VISIBLE,CRect(0,0,0,0), this, IDC_ACCOUNTS_VIEW, NULL)){ TRACE0("Failed to create Accounts View control.\n"); return -1;} These are the errors I get when I build the project having the above code written. ------ Build started: Project: falcon1, Configuration: Debug Win32 ------ Compiling... TabbedViewView.cpp c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\TabbedViewView.cpp(130) : error C2039: 'CTabbedViewView' : is not a member of 'CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\AccountsView.h(6) : see declaration of 'CAccountsView' c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\TabbedViewView.cpp(130) : error C2662: 'CTabbedViewView::Create' : cannot convert 'this' pointer from 'CAccountsView' to 'CTabbedViewView &' Reason: cannot convert from 'CAccountsView' to 'CTabbedViewView' Conversion requires a second user-defined-conversion operator or constructor ShortcutAccounts.cpp MainFrm.cpp AccountsView.cpp Generating Code... Build log was saved at "file://c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\Debug\BuildLog.htm" falcon1 - 2 error(s), 0 warning(s)
---------------------- Done ---------------------- Build: 0 succeeded, 1 failed, 0 skipped
Attached are my files in case I may have left some detail out. |
|
almatesic
Newbie Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
|
I have an update. I do not know if I am closer to solving this issue but according to the last problem there was an error saying "cannot convert from CAccountsView to CTabbedViewView" I went ahead and moved the virtual Create function to CAccountsView in the public section and only had an error in the linkage protion of the build. Here is the error for this. ------ Build started: Project: falcon1, Configuration: Debug Win32 ------ Compiling... TabbedViewView.cpp Generating Code... Skipping... (no relevant changes detected) ShortcutAccounts.cpp MainFrm.cpp AccountsView.cpp Linking... AccountsView.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CAccountsView::Create(char const *,char const *,unsigned long,struct tagRECT const &,class CWnd *,unsigned int,struct CCreateContext *)" (?Create@CAccountsView@@UAEHPBD0KABUtagRECT@@PAVCWnd@@IPAUCC reateContext@@@Z) TabbedViewView.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CAccountsView::Create(char const *,char const *,unsigned long,struct tagRECT const &,class CWnd *,unsigned int,struct CCreateContext *)" (?Create@CAccountsView@@UAEHPBD0KABUtagRECT@@PAVCWnd@@IPAUCC reateContext@@@Z) TabbedViewView.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CTabbedViewView::OnDragOver(class COleDataObject *,unsigned long,class CPoint)" (?OnDragOver@CTabbedViewView@@UAEKPAVCOleDataObject@@KVCPoin t@@@Z) Debug/falcon1.exe : fatal error LNK1120: 2 unresolved externals Build log was saved at "file://c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\Debug\BuildLog.htm" falcon1 - 4 error(s), 0 warning(s)
---------------------- Done ---------------------- Build: 0 succeeded, 1 failed, 0 skipped |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
I download attachment. To make it work 1. remove Create from TabedViewView.h. you added it to another class. 2. instead if (!m_accountsview.Create(NULL, NULL, WS_CHILD|WS_VISIBLE,CRect(0,0,0,0), this, IDC_ACCOUNTS_VIEW, NULL)) { TRACE0("Failed to create Accounts View control.\n"); return -1; } AddControl(_T("Accounts View"), &m_accountsview); use AddView(_T("Accounts View"), RUNTIME_CLASS(CAccountsView)); 3. Uncomment DROPEFFECT CTabbedViewView::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
Please find some book for C++, seems you don't understand basic things :(
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
almatesic
Newbie Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Hi Oleg! I can not thank you enough for giving me advice. You have taught me a lot over the past few weeks. You are truly the best!!! Are there any good reccomendations on books or online material so I could refer to them in times of trouble? I did as per instructed and I am still recievng the following error. I went ahead to project->properties, went ahead to see the settings in linker->Input. I have "Ignore All Default Libraries" set to no. Another thing is when I do build it, at times it is working then at times it gives me the error message below. I posted earlier but took it down because I thought I resolved the issue, but obviously I didn't. Linking... Linking... AccountsView.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CAccountsView::Create(char const *,char const *,unsigned long,struct tagRECT const &,class CWnd *,unsigned int,struct CCreateContext *)" (?Create@CAccountsView@@UAEHPBD0KABUtagRECT@@PAVCWnd@@IPAUCC reateContext@@@Z) Misc.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CMisc::Create(char const *,char const *,unsigned long,struct tagRECT const &,class CWnd *,unsigned int,struct CCreateContext *)" (?Create@CMisc@@UAEHPBD0KABUtagRECT@@PAVCWnd@@IPAUCCreateCon text@@@Z) Debug/falcon1.exe : fatal error LNK1120: 2 unresolved externals
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, You added declaration virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext); in h file, but not added implementation in cpp, liker can't find it and show error. To fix 1. delete declaration virtual BOOL Create(LPCTSTR, LPCTSTR, DWORD, const RECT&, CWnd*, UINT, CCreateContext*); in Misc.h 2. delete declaration virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext); in AccountsView.h
3. comment block if (!m_Myaccountsview.Create(NULL, NULL, WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, IDC_ACCOUNTS_VIEW, NULL)) { TRACE0("Failed to create Buisness Card View control.\n"); return -1; } because you already add it using AddView(_T("Business Card"), RUNTIME_CLASS(CAccountsView));
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |