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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. NM_RCLICK

NM_RCLICK

Scheduled Pinned Locked Moved C / C++ / MFC
databasequestion
3 Posts 2 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
    MemLeak
    wrote on last edited by
    #1

    Hi!, I use this code to get the column number of a CListControl into a CFormView. It works fine. But It work for right click. I cannot find a Handler for left click. Something like NM_LCLICK unstead of NM_RCLICK. BOOL CDataBaseManagerView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam; LPNMHDR pNH = (LPNMHDR) lParam; // wParam is zero for Header ctrl if( wParam == 0 && pNH->code == NM_RCLICK ) { // Right button was clicked on header CPoint pt(GetMessagePos()); CHeaderCtrl* pHeader =(CHeaderCtrl*)m_wndListCtrl.GetHeaderCtrl(); pHeader->ScreenToClient(&pt); // Determine the column index int index = 0; CRect rcCol; for( int i = 0 ; Header_GetItemRect(pHeader->m_hWnd, i, &rcCol) ; i++ ) { if( rcCol.PtInRect( pt ) ) { index = i; break; } } CString str; str.Format("Column no: %d", index); AfxMessageBox(str); } return CFormView::OnNotify(wParam, lParam, pResult); } any ideas? Thanks Everything's beautiful if you look at it long enough...

    M H 2 Replies Last reply
    0
    • M MemLeak

      Hi!, I use this code to get the column number of a CListControl into a CFormView. It works fine. But It work for right click. I cannot find a Handler for left click. Something like NM_LCLICK unstead of NM_RCLICK. BOOL CDataBaseManagerView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam; LPNMHDR pNH = (LPNMHDR) lParam; // wParam is zero for Header ctrl if( wParam == 0 && pNH->code == NM_RCLICK ) { // Right button was clicked on header CPoint pt(GetMessagePos()); CHeaderCtrl* pHeader =(CHeaderCtrl*)m_wndListCtrl.GetHeaderCtrl(); pHeader->ScreenToClient(&pt); // Determine the column index int index = 0; CRect rcCol; for( int i = 0 ; Header_GetItemRect(pHeader->m_hWnd, i, &rcCol) ; i++ ) { if( rcCol.PtInRect( pt ) ) { index = i; break; } } CString str; str.Format("Column no: %d", index); AfxMessageBox(str); } return CFormView::OnNotify(wParam, lParam, pResult); } any ideas? Thanks Everything's beautiful if you look at it long enough...

      M Offline
      M Offline
      MemLeak
      wrote on last edited by
      #2

      I found It!! BOOL CDataBaseManagerView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { //unstead of: HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam; // and: LPNMHDR pNH = (LPNMHDR) lParam; NMHDR *pHdr = (NMHDR*)lParam; //unstead of: if( wParam == 0 && pNH->code == NM_RCLICK ) if(pHdr->code == LVN_COLUMNCLICK) { ... } return CFormView::OnNotify(wParam, lParam, pResult); } Everything's beautiful if you look at it long enough...

      1 Reply Last reply
      0
      • M MemLeak

        Hi!, I use this code to get the column number of a CListControl into a CFormView. It works fine. But It work for right click. I cannot find a Handler for left click. Something like NM_LCLICK unstead of NM_RCLICK. BOOL CDataBaseManagerView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam; LPNMHDR pNH = (LPNMHDR) lParam; // wParam is zero for Header ctrl if( wParam == 0 && pNH->code == NM_RCLICK ) { // Right button was clicked on header CPoint pt(GetMessagePos()); CHeaderCtrl* pHeader =(CHeaderCtrl*)m_wndListCtrl.GetHeaderCtrl(); pHeader->ScreenToClient(&pt); // Determine the column index int index = 0; CRect rcCol; for( int i = 0 ; Header_GetItemRect(pHeader->m_hWnd, i, &rcCol) ; i++ ) { if( rcCol.PtInRect( pt ) ) { index = i; break; } } CString str; str.Format("Column no: %d", index); AfxMessageBox(str); } return CFormView::OnNotify(wParam, lParam, pResult); } any ideas? Thanks Everything's beautiful if you look at it long enough...

        H Offline
        H Offline
        Hari Krishnan Noida
        wrote on last edited by
        #3

        Hi, For Left Mouse Button, it is just NM_CLICK. regards ~Hari~

        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