Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Selection on right click Collapse All
Subject Author Date
Leland Dykes Jan 19, 2007 - 3:01 PM

In a CExtGridCellString subclass I’ve overridden OnClick() to detect right button up and pop up a menu with, of course, subsequent actions depending upon selection from the menu.

How do go about getting the selection to be set to the cursor position, as though it were a left button event, before I bring my menu?

Leland Dykes Jan 19, 2007 - 4:22 PM

Well, after scratching my head a bit more, I came up with a solution: Override CExtGridWnd::OnRButtonUp() and call CExtGridWnd::OnLButtonDown() before calling the base member function. If anyone has a better solution, I’m willing to entertain suggestions.
Thanks.

Technical Support Jan 20, 2007 - 1:43 PM

You can analyze any mouse click events by overriding the CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent() method. The CExtGridBaseWnd::SelectionSet() method allows you to set selection for a particular cell range. The CExtGridBaseWnd::FocusSet() method allows you to change both focus and selection at the same time and we think you should use it to set focus to the grid cell before tracking the context menu over it.