Hi!
In the following code, the edit box I created at run time is not editable, can someone please explain why? thanks!
Class CDerivedFromEdit :: public CEdit
{
BOOL Create(CWnd *pParentWnd, int type ,LPCTSTR lpszTitle = NULL);
}
Class CDerivedFromWnd :: public CWnd
{
CDerivedFromEdit m_newEditBox;
BOOL Create(CWnd *pParentWnd, CPoint create_point, int type ,LPCTSTR lpszTitle = NULL, LPCTSTR lpszSuper = NULL);
}
for the implementation:
BOOL CDerivedFromEdit::Create(CWnd *pParentWnd, int type ,LPCTSTR lpszTitle)
{
LPCTSTR lpszClassName = NULL;
//LPCTSTR lpszClassName = AfxRegisterWndClass(NULL, 0, (HBRUSH)1, 0);
LPCTSTR lpszWindowName = "TmTitleWnd";
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER;
DWORD dwExStyle = WS_EX_CLIENTEDGE;
int height = (type == TM_LINE_TYPE_MOVIE ? TM_IMAGE_HEIGHT : TM_SUPER_HEIGHT);
CRect rect(0, 0, TM_TITLE_WIDTH, height);
int nID = 10000;
return CEdit::CreateEx(dwExStyle,lpszClassName,lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
BOOL CDerivedFromWnd::Create(CWnd *pParentWnd, CPoint create_point, int type ,LPCTSTR lpszTitle = NULL, LPCTSTR lpszSuper = NULL);
{
LPCTSTR lpszClassName = NULL;
LPCTSTR lpszWindowName = "TmHScrollWnd";
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER;
int height = (type == TM_LINE_TYPE_MOVIE ? TM_IMAGE_HEIGHT : TM_SUPER_HEIGHT);
CRect rect(create_point.x,
create_point.y,
create_point.x + TM_TITLE_WIDTH + TM_SCROLL_WIDTH,
create_point.y + height);
int nID = 10000;
BOOL ret = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID);
BOOL ret_child;
ret_child = m_newEditBox.Create(this, type, lpszTitle);
/*CEdit* pEdit = new CEdit;
pEdit->Create(WS_CHILD | WS_VISIBLE,
rect, this, 1);*/
return ret;
}
can someone please explain to me why when I created a new CEdit pointer, I was allowed to edit while using the m_newEditBox variable which is a class derived from CEdit, the resulting editbox is non-editable?
VCnewbie
In the following code, the edit box I created at run time is not editable, can someone please explain why? thanks!
Class CDerivedFromEdit :: public CEdit
{
BOOL Create(CWnd *pParentWnd, int type ,LPCTSTR lpszTitle = NULL);
}
Class CDerivedFromWnd :: public CWnd
{
CDerivedFromEdit m_newEditBox;
BOOL Create(CWnd *pParentWnd, CPoint create_point, int type ,LPCTSTR lpszTitle = NULL, LPCTSTR lpszSuper = NULL);
}
for the implementation:
BOOL CDerivedFromEdit::Create(CWnd *pParentWnd, int type ,LPCTSTR lpszTitle)
{
LPCTSTR lpszClassName = NULL;
//LPCTSTR lpszClassName = AfxRegisterWndClass(NULL, 0, (HBRUSH)1, 0);
LPCTSTR lpszWindowName = "TmTitleWnd";
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER;
DWORD dwExStyle = WS_EX_CLIENTEDGE;
int height = (type == TM_LINE_TYPE_MOVIE ? TM_IMAGE_HEIGHT : TM_SUPER_HEIGHT);
CRect rect(0, 0, TM_TITLE_WIDTH, height);
int nID = 10000;
return CEdit::CreateEx(dwExStyle,lpszClassName,lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
BOOL CDerivedFromWnd::Create(CWnd *pParentWnd, CPoint create_point, int type ,LPCTSTR lpszTitle = NULL, LPCTSTR lpszSuper = NULL);
{
LPCTSTR lpszClassName = NULL;
LPCTSTR lpszWindowName = "TmHScrollWnd";
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER;
int height = (type == TM_LINE_TYPE_MOVIE ? TM_IMAGE_HEIGHT : TM_SUPER_HEIGHT);
CRect rect(create_point.x,
create_point.y,
create_point.x + TM_TITLE_WIDTH + TM_SCROLL_WIDTH,
create_point.y + height);
int nID = 10000;
BOOL ret = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID);
BOOL ret_child;
ret_child = m_newEditBox.Create(this, type, lpszTitle);
/*CEdit* pEdit = new CEdit;
pEdit->Create(WS_CHILD | WS_VISIBLE,
rect, this, 1);*/
return ret;
}
can someone please explain to me why when I created a new CEdit pointer, I was allowed to edit while using the m_newEditBox variable which is a class derived from CEdit, the resulting editbox is non-editable?
VCnewbie