Note that there are some explanatory texts on larger screens.

plurals
  1. POMFC CEdit lose focus handler
    primarykey
    data
    text
    <p>I am creating a MFC program using the document/view architecture. In the view I call on a cell class that extends CEdit to draw a text box. That works fine, however, when I try to catch a lose focus message for that text box nothing happens. I tried to overwrite PreTranslateMessage but that didn't work.</p> <p>Here's the code in the CGridView.cpp class:</p> <pre><code>void CGridView::OnInsertText() { CWnd* pParentWnd = this; CellText* pEdit = new CellText(&amp;grid, pParentWnd); Invalidate(); UpdateWindow(); } </code></pre> <p>the CellText.cpp:</p> <pre><code>CellText::CellText(Grid *pgrid, CWnd* pParentWnd) { int *pcoordinates = pgrid-&gt;GetSelectedCellCoodrinates(); cedit.Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(*pcoordinates+10, *(pcoordinates+1)+10, *(pcoordinates+2)-10, *(pcoordinates+3)-10), pParentWnd, 1); cell = pgrid-&gt;GetSelectedCell(); pgrid-&gt;SetCellType(cell, "text"); grid = pgrid; } BEGIN_MESSAGE_MAP(CellText, CEdit) ON_WM_KILLFOCUS() ON_WM_KEYDOWN() END_MESSAGE_MAP() // CellText message handlers void CellText::OnKillFocus(CWnd* pNewWnd) { CEdit::OnKillFocus(pNewWnd); CString str; GetWindowTextW(str); grid-&gt;SetCellText(cell, str); cedit.DestroyWindow(); } BOOL CellText::PreTranslateMessage(MSG* pMsg) { if(pMsg-&gt;message==WM_KEYDOWN) { if(pMsg-&gt;wParam==VK_UP) { } } return CWnd::PreTranslateMessage(pMsg); } </code></pre> <p>When I debug, the onkillfocus and pretranslatemessage aren't called at all.</p> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload