Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Inheriting a new View Class for MDI

Inheriting a new View Class for MDI

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicsgame-devperformancehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NTense
    wrote on last edited by
    #1

    I'm getting an error when I try to inherit a new view class for a MDI application, and I can't figure out why :/ .. First I created an OpenGL viewport inherited from CView, and packed it with all kinds of functionality. It works great. But now I'm trying to derive a new view class from it, and I'm getting the following error (using VC++ 6.0 professional): C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2039: 'classCMotionXModelView' : is not a member of 'CMotionXModelView' c:\development\motionx\motionxmodelview.h(15) : see declaration of 'CMotionXModelView' C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2065: 'classCMotionXModelView' : undeclared identifier The thing is, I'm just deriving it from a class that is fully functional, and haven't added anything except a member variable to it. This is the view class declaration that works: #if !defined(AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_) #define AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // MotionXGLView.h : header file // #include "gl/gl.h" #include "gl/glu.h" #include "gl/glaux.h" #include "MotionXSceneDoc.h" #include "MotionXCamera.h" #include "MotionXModel.h" // Added by ClassView ///////////////////////////////////////////////////////////////////////////// // CMotionXGLView view // Define Viewport modes #define PERSPECTIVE 0 #define FRONT 1 #define BACK 2 #define LEFT 3 #define RIGHT 4 #define TOP 5 #define BOTTOM 6 class CMotionXGLView : public CView { protected: CMotionXGLView(); // protected constructor used by dynamic creation DECLARE_DYNCREATE(CMotionXGLView) // Attributes public: // Operations public: CMotionXModel model; void DrawGrid(); void SwitchViewportMode(unsigned int); void DollyViewport(const float speed); void PitchAroundPoint(const float speed); void RotateAroundPoint(const float speed); inline void PedistalViewport(float speed); inline void StrafeViewport(float speed); CMotionXCamera viewCam; BOOL SetupPixelFormat(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMotionXGLView) public: virtual void OnInitialUpdate(); protected: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL OnCommand(WPARAM wP

    R 1 Reply Last reply
    0
    • N NTense

      I'm getting an error when I try to inherit a new view class for a MDI application, and I can't figure out why :/ .. First I created an OpenGL viewport inherited from CView, and packed it with all kinds of functionality. It works great. But now I'm trying to derive a new view class from it, and I'm getting the following error (using VC++ 6.0 professional): C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2039: 'classCMotionXModelView' : is not a member of 'CMotionXModelView' c:\development\motionx\motionxmodelview.h(15) : see declaration of 'CMotionXModelView' C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2065: 'classCMotionXModelView' : undeclared identifier The thing is, I'm just deriving it from a class that is fully functional, and haven't added anything except a member variable to it. This is the view class declaration that works: #if !defined(AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_) #define AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // MotionXGLView.h : header file // #include "gl/gl.h" #include "gl/glu.h" #include "gl/glaux.h" #include "MotionXSceneDoc.h" #include "MotionXCamera.h" #include "MotionXModel.h" // Added by ClassView ///////////////////////////////////////////////////////////////////////////// // CMotionXGLView view // Define Viewport modes #define PERSPECTIVE 0 #define FRONT 1 #define BACK 2 #define LEFT 3 #define RIGHT 4 #define TOP 5 #define BOTTOM 6 class CMotionXGLView : public CView { protected: CMotionXGLView(); // protected constructor used by dynamic creation DECLARE_DYNCREATE(CMotionXGLView) // Attributes public: // Operations public: CMotionXModel model; void DrawGrid(); void SwitchViewportMode(unsigned int); void DollyViewport(const float speed); void PitchAroundPoint(const float speed); void RotateAroundPoint(const float speed); inline void PedistalViewport(float speed); inline void StrafeViewport(float speed); CMotionXCamera viewCam; BOOL SetupPixelFormat(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMotionXGLView) public: virtual void OnInitialUpdate(); protected: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL OnCommand(WPARAM wP

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      NTense wrote: //DECLARE_DYNCREATE(CMotionXModelView); Uncomment this in your derived class, and add IMPLEMENT_DYNCREATE(CMotionXModelView, CMotionXGLView) in your .cpp file

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups