-
February 16th, 2009, 11:15 PM
#1
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.
-
February 17th, 2009, 02:10 AM
#2
Re: How to get co-ordinate pts of items in a list control..???
What messages have you handled for the context menu?
-
February 17th, 2009, 02:20 AM
#3
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
-
February 17th, 2009, 04:38 AM
#4
Re: How to get co-ordinate pts of items in a list control..???
Originally Posted by ckweius
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!
Originally Posted by LOOSER_007
.. 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.
Originally Posted by LOOSER_007
.. 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|