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.... :)
Re: How to get co-ordinate pts of items in a list control..???
What messages have you handled for the context menu?
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
Re: How to get co-ordinate pts of items in a list control..???
Quote:
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!
Quote:
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.
Quote:
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.