Print Page | Close Window

How to add a FormView to the CXTTabView

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2757
Printed Date: 08 November 2025 at 9:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to add a FormView to the CXTTabView
Posted By: liuxuowen
Subject: How to add a FormView to the CXTTabView
Date 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?




Replies:
Posted By: AliRafiee
Date 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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net