|
-
August 24th, 1999, 03:55 PM
#1
CEdit::Create()
I have a CFormView that I want to create my own CEdit control on. I have the following defined in my .h file for the view:
...
CEdit *m_Edit;
...
in my implementation code I have in OnInitialUpdate():
m_Edit = new CEdit;
if (m_Edit != NULL)
{
if (m_Edit->Create(WS_CHILD | WS_VISIBLE,
CRect(20, 20, 120, 120),
this,
IDC_MYEDIT) == NULL)
{
AfxMessageBox("Failed to create CEdit");
return;
}
m_Edit->ShowWindow(SW_SHOW);
}
The CEdit fails to display. I basically followed the example "Adding Controls by Hand", the only difference is that I am using a CFormView instead of a CDialog, and I am using a CEdit *m_Edit instead of a CEdit m_Edit.
Why does this not work?
Be_ginner
-
August 24th, 1999, 07:50 PM
#2
Re: CEdit::Create()
Try to get error:
DWORD dwError=GetLastError();
then check it with ErrorLookUp utility. I'm sure you just cannot create CEdit on the View.
Dmitriy, MCSE
-
August 24th, 1999, 10:02 PM
#3
Re: CEdit::Create()
you don't need to do a GetLastError:
after a line of code that would have resulted in a call to SetLastError, all you have to do is watch (shift-f9) for 'err', and that will have the last error code
-
August 25th, 1999, 01:27 PM
#4
Re: CEdit::Create()
Well,
After not getting any errors, I double-checked my create code and I wasn't using WS_CHILD. Therefore, no error and the control just wasn't displayed. After adding WS_CHILD, it's working great.
Thanks for your ideas though. They helped me find that the error was easier than I thought.
Be_ginner
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|