Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Forward key to another controller

Forward key to another controller

Scheduled Pinned Locked Moved C / C++ / MFC
question
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mathias S
    wrote on last edited by
    #1

    In a dialog I got a CEdit and a ListCtrl. And when I press any A-Z key in the ListCtrl I want that key to be forwarded to the edit controller and focus to be change so that continues writing will be in the CEdit. The solution I came up with is this. It appears to work. But I get a bad felling about this solution. Anyone know if this is a correct way of doing this // m_pEdit is a pointer to the CEdit. void CMyListCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if( nChar >= 'a'&& nChar <= 'z' || nChar >= 'A'&& nChar <= 'Z') { m_pEdit->PostMessage( WM_CHAR , (WCHAR)nChar,MAKELPARAM(nRepCnt,nFlags) ); m_pEdit->SetFocus(); return; } CListCtrl::OnChar(nChar, nRepCnt, nFlags); } Or should I do this from OnKeyDown instead? /Mathias S.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups