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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. clistcrtl OnUpdate() [modified]

clistcrtl OnUpdate() [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingjsonquestionannouncement
3 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.
  • S Offline
    S Offline
    shiftwik
    wrote on last edited by
    #1

    Hello I can't figure this out . Here is my class and functions For some reason the OnUpdate function is only printing the first column and not the other 1 What am I doing wrong?? thx // viewcView.h : interface of the CViewcView class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_) #define AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CViewcView : public CView { protected: // create from serialization only CViewcView(); DECLARE_DYNCREATE(CViewcView) CListCtrl m_List; // Attributes public: CViewcDoc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CViewcView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual void OnInitialUpdate(); // first time after construct virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~CViewcView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CViewcView) // NOTE - the ClassWizard will add and remove member functions here. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in viewcView.cpp inline CViewcDoc* CViewcView::GetDocument() { return (CViewcDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_) // viewcView.cpp : implementation of the CViewcView class // #include "stdafx.h" #include "viewc.h" #include "viewcDoc.h" #include "viewcView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __

    D 2 Replies Last reply
    0
    • S shiftwik

      Hello I can't figure this out . Here is my class and functions For some reason the OnUpdate function is only printing the first column and not the other 1 What am I doing wrong?? thx // viewcView.h : interface of the CViewcView class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_) #define AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CViewcView : public CView { protected: // create from serialization only CViewcView(); DECLARE_DYNCREATE(CViewcView) CListCtrl m_List; // Attributes public: CViewcDoc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CViewcView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual void OnInitialUpdate(); // first time after construct virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~CViewcView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CViewcView) // NOTE - the ClassWizard will add and remove member functions here. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in viewcView.cpp inline CViewcDoc* CViewcView::GetDocument() { return (CViewcDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_) // viewcView.cpp : implementation of the CViewcView class // #include "stdafx.h" #include "viewc.h" #include "viewcDoc.h" #include "viewcView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      shiftwik wrote:

      For some reason the OnUpdate function is only printing the first column and not the other 2

      You've only created two columns, not three.


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      1 Reply Last reply
      0
      • S shiftwik

        Hello I can't figure this out . Here is my class and functions For some reason the OnUpdate function is only printing the first column and not the other 1 What am I doing wrong?? thx // viewcView.h : interface of the CViewcView class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_) #define AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CViewcView : public CView { protected: // create from serialization only CViewcView(); DECLARE_DYNCREATE(CViewcView) CListCtrl m_List; // Attributes public: CViewcDoc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CViewcView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual void OnInitialUpdate(); // first time after construct virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~CViewcView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CViewcView) // NOTE - the ClassWizard will add and remove member functions here. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in viewcView.cpp inline CViewcDoc* CViewcView::GetDocument() { return (CViewcDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_VIEWCVIEW_H__C9A435B3_A707_486C_820E_191CD7126DDD__INCLUDED_) // viewcView.cpp : implementation of the CViewcView class // #include "stdafx.h" #include "viewc.h" #include "viewcDoc.h" #include "viewcView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Why is the view derived from CView instead of CListView? :confused: I would not even bother trying to figure out what is wrong (which is a combination of creating the control dynamically and the OnSize() method) until I at least did that.


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        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