CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2008
    Location
    India
    Posts
    186

    Question How to get co-ordinate pts of items in a list control..???

    I am using Doc/View arch in my application, there is a list control in one of the view also some items in other view..... I need to know the co-ordinates of these items programmatically... also i want to use "Right Click" button available in the keyboard to popup a menu at this co-ordinates... i am able to popup a menu on a mouse rt click but not with the keyboard....???

    Please anybody tell me the way to do this....!!!!
    It would be helpful if u can post any of the sample code related to this....
    Last edited by LOOSER_007; February 16th, 2009 at 11:17 PM.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: How to get co-ordinate pts of items in a list control..???

    What messages have you handled for the context menu?
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Mar 2004
    Location
    KL, Malaysia
    Posts
    63

    Re: How to get co-ordinate pts of items in a list control..???

    To get position of controls, you could do this:

    Code:
    CRect rcRect;
    myListCtrl.GetWindowRect(&rcRect);
    Kevin Choong

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: How to get co-ordinate pts of items in a list control..???

    Quote Originally Posted by ckweius View Post
    To get position of controls, you could do this:

    Code:
    CRect rcRect;
    myListCtrl.GetWindowRect(&rcRect);
    But OP needs to get coordinates of list control item(s), not a control itself!

    Quote Originally Posted by LOOSER_007 View Post
    .. there is a list control in one of the view also some items in other view..... I need to know the co-ordinates of these items programmatically...
    Have a look at CListCtrl::GetItemRect and CListCtrl::GetSubItemRect methods in MSDN.

    Quote Originally Posted by LOOSER_007 View Post
    .. also i want to use "Right Click" button available in the keyboard to popup a menu at this co-ordinates... i am able to popup a menu on a mouse rt click but not with the keyboard....???

    Please anybody tell me the way to do this....!!!!
    It would be helpful if u can post any of the sample code related to this....
    As cilu guessed, you might implement it in some wrong message handler?
    You should do it in OnContextMenu message handler (message WM_CONTEXTMENU) in your View (or CListCtrl) derived class.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured