Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Form View in a Tab
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Form View in a Tab

 Post Reply Post Reply
Author
Message
almatesic View Drop Down
Newbie
Newbie
Avatar

Joined: 25 November 2005
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote almatesic Quote  Post ReplyReply Direct Link To This Post Topic: Form View in a Tab
    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'

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2005 at 1:42am

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
Back to Top
almatesic View Drop Down
Newbie
Newbie
Avatar

Joined: 25 November 2005
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote almatesic Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2005 at 8:50am

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
Whatever I am doing to try to correct the proeblem it seems to be giving me more errors than what i already have.

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'

Back to Top
almatesic View Drop Down
Newbie
Newbie
Avatar

Joined: 25 November 2005
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote almatesic Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2005 at 5:39pm

Here are the things that I've tried doing:

1) CTabbedViewView::CTabbedViewView()
: CFormView(CAccountsView::IDD)

{

// TODO: add construction code here

m_iHitTest = -1;

m_nIDEvent = 20;

}

but that didn not work.

2) I tried making the class public in afxext.h
3) I tried bringing the accountview class completely into TabbedViewvew.h and that didn't work either.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 December 2005 at 10:09am

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
Back to Top
almatesic View Drop Down
Newbie
Newbie
Avatar

Joined: 25 November 2005
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote almatesic Quote  Post ReplyReply Direct Link To This Post Posted: 03 January 2006 at 5:40pm

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.
2006-01-03_173800_falcon1.rar

Back to Top
almatesic View Drop Down
Newbie
Newbie
Avatar

Joined: 25 November 2005
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote almatesic Quote  Post ReplyReply Direct Link To This Post Posted: 03 January 2006 at 5:49pm

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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2006 at 12:37am

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
Back to Top
almatesic View Drop Down
Newbie
Newbie
Avatar

Joined: 25 November 2005
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote almatesic Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2006 at 6:34pm

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

 

2006-01-04_183445_falcon1.rar

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2006 at 2:04am

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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.656 seconds.