"Bug" in CXTPReportInplaceEdit |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 02 August 2006 at 9:40pm |
If you have enabled multiline support in a report control, you most certainly want the enter key to behave as "insert new line character" instead of cancelling the editing. See code below. Perhaps it would be a good idea to have a SetCancelOnReturn(BOOL bCancel)-method? void CXTPReportInplaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
If I want this change immediately, do I have to compile the whole source or can I somehow subclass this control? I cannot come up with a nice solution.
{ if (!pControl) return; if (nChar == VK_TAB) return; // if (nChar == VK_ESCAPE || nChar == VK_RETURN) // FIX: Take "want return" style into account if (nChar == VK_ESCAPE || (nChar == VK_RETURN && !(GetStyle() & ES_WANTRETURN))) { pControl->EditItem(NULL); return; } ... } Thanks!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Thanks for a suggestion, easier is to compiler the whole source.
BTW, if you use a solution from a topic: http://forum.codejock.com/forum_posts.asp?TID=4700, i.e. pColumn->GetEditOptions()->m_dwEditStyle |= ES_MULTILINE | ES_AUTOVSCROLL; -- you can insert new line char with Ctrl+Enter -- WBR, Serge |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Actually, it's easier to make a little hack. Here's a solution if anybody else encounters the same problem:
BOOL CMyView::PreTranslateMessage(MSG* pMsg)
{ if (pMsg->message == WM_CHAR && pMsg->wParam == VK_RETURN) { if (m_myReport.GetInplaceEdit()->IsWindowVisible()) pMsg->wParam = 0x0A; // Ctrl+Enter. Voilą! } return CXTResizeFormView::PreTranslateMessage(pMsg); } |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
I am able to set the multiline property by applying pColumn->GetEditOptions()->m_dwEditStyle |= ES_MULTILINE | ES_AUTOVSCROLL; but ES_AUTOVSCROLL is not setting. Please see attached screenshot. any other way to set it? -Mak
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |