Inplace Edit control?

There is an article on Code Guru regarding an "in-place" edit control that I can definately use in my project. The problem is that running the example app and looking at it's code, I cannot for the life of me figure out how the get it to work with ES_WANTRETURN and ES_MULTILINE.

Has anyone looked at this control and got it working as it is?
Could someone look at this code and help me implement the multi-line feature?

Link:
http://www.dev-archive.com/cpp/controls/editctrl/backgroundcolor/article.php/c6857/

My requirements are that it must work with Multi-line, want return, and rect limitations. Any help or thoughts?

Mike B
[679 byte] By [MikeB] at [2007-11-20 1:26:49]
# 1 Re: Inplace Edit control?
but the edit seems to have ES_WANTRETURN and ES_MULTILINE already:

BOOL CInplaceEdit::CreateEditor( CWnd* pParentWnd )
{
BOOL bResult = FALSE;

CRect r( 0, 0, ED_DEFAULT_WIDTH, ED_DEFAULT_HEIGHT );

if ( Create( ES_WANTRETURN | ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE,
r, pParentWnd, IDC_INPLACE_EDIT ) )
{
SetParent( pParentWnd );
SetLimitText( 0 );

bResult = TRUE;
}

return bResult;
}
Alin at 2007-11-10 23:18:24 >
# 2 Re: Inplace Edit control?
but the edit seems to have ES_WANTRETURN and ES_MULTILINE already:

BOOL CInplaceEdit::CreateEditor( CWnd* pParentWnd )
{
BOOL bResult = FALSE;

CRect r( 0, 0, ED_DEFAULT_WIDTH, ED_DEFAULT_HEIGHT );

if ( Create( ES_WANTRETURN | ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE,
r, pParentWnd, IDC_INPLACE_EDIT ) )
{
SetParent( pParentWnd );
SetLimitText( 0 );

bResult = TRUE;
}

return bResult;
}

Yes, I know, the problem is that when I run the test app and press return, nothing happens, it doesn't go to the next line.

BTW, I tried to create a similar class in my application and it fails to create the CEdit control.

BOOL CInPlaceEdit::CreateInplaceEdit(CWnd* pParent)
{
CRect rc(100, 100, 200, 200);

if(!CreateEx(WS_EX_TOPMOST|WS_EX_TRANSPARENT, _T("Edit"), _T(""),
WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_WANTRETURN,
rc, pParent, IDC_INPLACE_EDIT))
return FALSE;
return TRUE;
}

I get the warnings on the OUTPUT window:

Warning: no shared menu/acceltable for MDI Child window.
Warning: Window creation failed: GetLastError returns 0x0000057E

I don't know what this means and I cannot find anything on google!

Any ideas?

Mike B
MikeB at 2007-11-10 23:19:25 >
# 3 Re: Inplace Edit control?
Yes, I know, the problem is that when I run the test app and press return, nothing happens, it doesn't go to the next line.
Nothing happens because it is sized to fit a single line of text and ES_AUTOVSCROLL style is not set.
ovidiucucu at 2007-11-10 23:20:24 >
# 4 Re: Inplace Edit control?
Nothing happens because it is sized to fit a single line of text and ES_AUTOVSCROLL style is not set.
Hmmmm, I didn't even notice that. For some reason I was thinking the default behavior of the CEdit was to "grow" to fit when Multiline is set, but I know that is not true.

Thanks, that makes sence!

Mike B :thumb:
MikeB at 2007-11-10 23:21:25 >