I have a view which is derived from CEditView. It is read only. I would like to set the text as a kind of logging, but nothing shows up on the screen. If I inspect temp
in the debugger after GetEditCtrl().GetWindowText(temp);
I can see that the text is indeed changing internally, but I see nothing on the screen.
// HistoryView.cpp : implementation file
//
#include "stdafx.h"
#include "HistoryView.h"
// CHistoryView
IMPLEMENT_DYNCREATE(CHistoryView, CEditView)
CHistoryView::CHistoryView()
{
}
CHistoryView::~CHistoryView()
{
}
BEGIN_MESSAGE_MAP(CHistoryView, CEditView)
END_MESSAGE_MAP()
// CHistoryView diagnostics
#ifdef _DEBUG
void CHistoryView::AssertValid() const
{
CEditView::AssertValid();
}
#ifndef _WIN32_WCE
void CHistoryView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
#endif
#endif //_DEBUG
// CHistoryView message handlers
void CHistoryView::OnInitialUpdate()
{
CEditView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
GetEditCtrl().SetReadOnly(TRUE);
}
//!
/*!
*/
void CHistoryView::AddRow(CString message)
{
CString temp;
GetEditCtrl().GetWindowText(temp);
if(temp.IsEmpty())
{
GetEditCtrl().SetWindowText(message);
}
else
{
GetEditCtrl().SetWindowText(temp + "\r\n" + message);
}
GetEditCtrl().LineScroll(2, 0);
//GetEditCtrl().UpdateWindow(); // no effect
}