Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is the parent window of a cedit class?

Status
Not open for further replies.

VCNewbie

Programmer
Dec 5, 2001
8
PH
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top