Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to add a FormView to the CXTTabView
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add a FormView to the CXTTabView

 Post Reply Post Reply
Author
Message
liuxuowen View Drop Down
Newbie
Newbie


Joined: 21 August 2005
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote liuxuowen Quote  Post ReplyReply Direct Link To This Post Topic: How to add a FormView to the CXTTabView
    Posted: 21 August 2005 at 8:55pm

I want to add a Formview to the CXTTabView, but it cannot show the Formview dialog. my code:
in MyAppView::OnCreate: (derived from CXTTabView)
 m_pVideoPlayView = new CVideoPlayView //;(CVideoPlayView is derived from CFormView)
if ( m_pVideoPlayView && ::IsWindow( m_pVideoPlayView->m_hWnd ) )
 {
  m_pVideoPlayView->DestroyWindow();
 }
 CCreateContext cc;
 ZeroMemory(&cc, sizeof(cc));
 m_pVideoPlayView = (CVideoPlayView*)RUNTIME_CLASS(CVideoPlayView)->CreateObj ect();
 if (!m_pVideoPlayView  || !((CWnd *)m_pVideoPlayView)->Create(
  NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, VIDEOPLAY, &cc))
 {
  TRACE0( "Failed to create video videoplay view.\n" );
  return -1;
 }
AddView(_T("VideoPlayer"), m_pVideoPlayView);

The result of the AddView is successful, but when i run my app, i cannot see the dialog in the revalant page. did i loss some initializations?



Edited by liuxuowen
Back to Top
AliRafiee View Drop Down
Groupie
Groupie


Joined: 06 May 2004
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote AliRafiee Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2005 at 11:29am

One, you have a memroy leak.  You new the CVideoPlayerView, and then override the pointer with CreateObject!!!! new or CreateObject, One or the other not both.

Have you tried giving your view a size when you create it.  

Or maybe consider using the alternate AddView

AddView(_T("VideoPlayer"),RUNTIMECLASS(CVideoPlayerView));

m_pVideoplay = (CVideoPlayerView *)GetView(0);

 

Ali

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.047 seconds.