Click here to Skip to main content
15,881,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Spin Control Problem Pin
Russell'30-Aug-07 22:08
Russell'30-Aug-07 22:08 
Questionbrothers and sisters,help me! Pin
youbo30-Aug-07 15:35
youbo30-Aug-07 15:35 
AnswerRe: brothers and sisters,help me! Pin
Russell'30-Aug-07 22:19
Russell'30-Aug-07 22:19 
QuestionFilling Dialog Box from .txt file Pin
dtagliente30-Aug-07 12:04
dtagliente30-Aug-07 12:04 
QuestionRe: Filling Dialog Box from .txt file Pin
Mark Salsbery30-Aug-07 12:23
Mark Salsbery30-Aug-07 12:23 
AnswerRe: Filling Dialog Box from .txt file Pin
Iain Clarke, Warrior Programmer30-Aug-07 12:26
Iain Clarke, Warrior Programmer30-Aug-07 12:26 
AnswerRe: Filling Dialog Box from .txt file Pin
Mark Salsbery30-Aug-07 12:56
Mark Salsbery30-Aug-07 12:56 
Questionclistcrtl OnUpdate() [modified] Pin
shiftwik30-Aug-07 10:31
shiftwik30-Aug-07 10:31 
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[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CViewcView

IMPLEMENT_DYNCREATE(CViewcView, CView)

BEGIN_MESSAGE_MAP(CViewcView, CView)
//{{AFX_MSG_MAP(CViewcView)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CViewcView construction/destruction

CViewcView::CViewcView()
{
// TODO: add construction code here

}

CViewcView::~CViewcView()
{
}

int CViewcView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;

CRect rect;
GetClientRect(rect);
VERIFY (m_List.Create (WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SINGLESEL,
CRect (0, 0, 0, 0), this, 1));

return 0;
}



void CViewcView::OnInitialUpdate()
{
CView::OnInitialUpdate();


VERIFY (-1 != m_List.InsertColumn (0, "Part Number", LVCFMT_LEFT, 100));
VERIFY (-1 != m_List.InsertColumn (1, "Part Desc", LVCFMT_LEFT, 100));



}


void CViewcView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{

CView::OnUpdate (pSender, lHint, pHint);


int nItem = m_List.InsertItem(0, "column0");
m_List.SetItemText(nItem, 1, "column1");


}






BOOL CViewcView::PreCreateWindow(CREATESTRUCT& cs)
{


return CView::PreCreateWindow(cs);
}












/////////////////////////////////////////////////////////////////////////////
// CViewcView drawing

void CViewcView::OnDraw(CDC* pDC)
{
CViewcDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CViewcView printing

BOOL CViewcView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}

void CViewcView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}

void CViewcView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CViewcView diagnostics

#ifdef _DEBUG
void CViewcView::AssertValid() const
{
CView::AssertValid();
}

void CViewcView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}

CViewcDoc* CViewcView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CViewcDoc)));
return (CViewcDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CViewcView message handlers





void CViewcView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);

m_List.MoveWindow (0, 0, cx, cy);
}


-- modified at 18:26 Thursday 30th August, 2007
AnswerRe: clistcrtl OnUpdate() Pin
David Crow30-Aug-07 10:38
David Crow30-Aug-07 10:38 
QuestionRe: clistcrtl OnUpdate() Pin
David Crow31-Aug-07 3:08
David Crow31-Aug-07 3:08 
Questionfailed to identify calling batch script Pin
Jack Rong30-Aug-07 9:22
Jack Rong30-Aug-07 9:22 
QuestionAssigning port number to TDI server code Pin
barun_iit30-Aug-07 8:50
barun_iit30-Aug-07 8:50 
QuestionMFC Displaying Text Pin
barbarini30-Aug-07 6:15
barbarini30-Aug-07 6:15 
AnswerRe: MFC Displaying Text Pin
hxhl9530-Aug-07 6:22
hxhl9530-Aug-07 6:22 
GeneralRe: MFC Displaying Text Pin
barbarini30-Aug-07 6:25
barbarini30-Aug-07 6:25 
QuestionRe: MFC Displaying Text Pin
hxhl9530-Aug-07 6:28
hxhl9530-Aug-07 6:28 
GeneralRe: MFC Displaying Text Pin
Dennis Gourjii30-Aug-07 6:29
Dennis Gourjii30-Aug-07 6:29 
GeneralRe: MFC Displaying Text Pin
barbarini30-Aug-07 6:42
barbarini30-Aug-07 6:42 
GeneralRe: MFC Displaying Text Pin
Dennis Gourjii1-Sep-07 22:58
Dennis Gourjii1-Sep-07 22:58 
AnswerRe: MFC Displaying Text Pin
Mark Salsbery30-Aug-07 6:42
Mark Salsbery30-Aug-07 6:42 
GeneralRe: MFC Displaying Text Pin
barbarini30-Aug-07 6:48
barbarini30-Aug-07 6:48 
GeneralRe: MFC Displaying Text Pin
Mark Salsbery30-Aug-07 6:56
Mark Salsbery30-Aug-07 6:56 
GeneralRe: MFC Displaying Text Pin
barbarini30-Aug-07 8:42
barbarini30-Aug-07 8:42 
GeneralRe: MFC Displaying Text Pin
bob1697230-Aug-07 15:29
bob1697230-Aug-07 15:29 
GeneralRe: MFC Displaying Text Pin
Mark Salsbery30-Aug-07 20:33
Mark Salsbery30-Aug-07 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.