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. get the cursor coord in a CListCtrl

get the cursor coord in a CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 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.
  • F Offline
    F Offline
    Fred D
    wrote on last edited by
    #1

    hi all, could anybody give a hint on how to retrieve the cursor coordinate (CPoint) in a CListCtrl ? prog. running on Win CE 3.0 i want to display a pop-up menu where the user click somewhere in the List, to do so i need to get the cursor coord. i've triied : void C..::OnLButtonUp(UINT nFlags, CPoint point) // it only works in the View, not inside the control :( void C..::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) //here there is no direct way to get the position.. any idea ? thanx Fred

    L F 4 Replies Last reply
    0
    • F Fred D

      hi all, could anybody give a hint on how to retrieve the cursor coordinate (CPoint) in a CListCtrl ? prog. running on Win CE 3.0 i want to display a pop-up menu where the user click somewhere in the List, to do so i need to get the cursor coord. i've triied : void C..::OnLButtonUp(UINT nFlags, CPoint point) // it only works in the View, not inside the control :( void C..::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) //here there is no direct way to get the position.. any idea ? thanx Fred

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Put this in your OnClickList or what ever its called.

      CPoint point;
      GetCursorPos( &point );
      m_listCtrl.ScreenToClient( &point );

      Then display your pop-up menu at point


      -Raffi

      1 Reply Last reply
      0
      • F Fred D

        hi all, could anybody give a hint on how to retrieve the cursor coordinate (CPoint) in a CListCtrl ? prog. running on Win CE 3.0 i want to display a pop-up menu where the user click somewhere in the List, to do so i need to get the cursor coord. i've triied : void C..::OnLButtonUp(UINT nFlags, CPoint point) // it only works in the View, not inside the control :( void C..::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) //here there is no direct way to get the position.. any idea ? thanx Fred

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Oops, just realize that you dont have to put the ScreenToClient part in there. I should be:

        CPoint point;
        GetCursorPos( &point );

        And display your pop-up menu at point.


        -Raffi

        1 Reply Last reply
        0
        • F Fred D

          hi all, could anybody give a hint on how to retrieve the cursor coordinate (CPoint) in a CListCtrl ? prog. running on Win CE 3.0 i want to display a pop-up menu where the user click somewhere in the List, to do so i need to get the cursor coord. i've triied : void C..::OnLButtonUp(UINT nFlags, CPoint point) // it only works in the View, not inside the control :( void C..::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) //here there is no direct way to get the position.. any idea ? thanx Fred

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Try: NM_LISTVIEW *plv = ( NM_LISTVIEW * )pNMHDR; UINT uflag ; m_wndListCtrl.HitTest( plv->ptAction , &uflag ); if( uflag == LVHT_ONITEMICON ) .... Here plv->ptAction is the cursor coordinate and you don't need to use ScreentToClient() Cheers

          1 Reply Last reply
          0
          • F Fred D

            hi all, could anybody give a hint on how to retrieve the cursor coordinate (CPoint) in a CListCtrl ? prog. running on Win CE 3.0 i want to display a pop-up menu where the user click somewhere in the List, to do so i need to get the cursor coord. i've triied : void C..::OnLButtonUp(UINT nFlags, CPoint point) // it only works in the View, not inside the control :( void C..::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) //here there is no direct way to get the position.. any idea ? thanx Fred

            F Offline
            F Offline
            Fred D
            wrote on last edited by
            #5

            thanx guys ! just a simple GetCursorPos() do it ! :) @+ Fred

            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