CGXGridCore::OnRButtonHitRowCol
virtual BOOL OnRButtonHitRowCol(ROWCOL nHitRow, ROWCOL nHitCol, ROWCOL nDragRow, ROWCOL nDragCol, CPoint point, UINT flags, WORD nHitState);?
nHitRow
Specifies the row id where the user clicked the mouse.
nHitCol
Specifies the column id where the user clicked the mouse.
nDragRow
Specifies the row id where the user has dragged the mouse.
nDragCol
Specifies the column id where the user has dragged the mouse.
point
Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.
flags
-
Indicates whether various virtual keys are down. This parameter can be any combination of the following values:
- MK_CONTROL Set if the CTRL key is down.
- MK_LBUTTON Set if the left mouse button is down.
- MK_MBUTTON Set if the middle mouse button is down.
- MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
nHitState
-
Specifies the state of the interaction. This parameter can be any combination of the following values:
- GX_HITSTART: Mouse button has been pressed
- GX_HITMOVE: Mouse cursor has been moved.
- GX_HITEND: Mouse button has been released.
- GX_SELECT: Cells will be selected.
- GX_HITINCELL: Mouse cursor is in the cell where the mouse button has been pressed.
- GX_HITLEAVE: Mouse cursor has left the cell where the mouse button has been pressed.
- GX_CTRLPRESSED: User pressed the mouse button while pressing the CTRL key.
GX_HITCURRENTCELL: User pressed mouse in current cell.
Return Value
TRUE if action has been successfully processed; FALSE if it failed. If nHitStartis GX_HITSTARTand you return FALSE, you can prevent switching the grid to autoscroll mode and cancel the current operation.
Remarks
This method is called when the user has clicked the right mouse button in a cell. Subsequent calls occur when the mouse is dragged and when the user releases the mouse button.
The base-class version of this method calls the RButtonDown, MouseMove and RButtonUp methods of the control associated with the cell where the user clicked the mouse. If the user pressed the mouse on a new cell but the current cell’s data is invalid, OnRButtonHitRowCol will return FALSE. This prevents further user interaction with the grid.
You should override this method if you want to implement some dragging capabilities in your grid.
If you only want to check where the user pressed a mouse and depending on the mouse position start some actions, you should process the OnRButtonDown message and determine the HitTest value. When you call the base-class OnRButtonDown message, OnRButtonHitRowCol will be called.
See Also
CGXControl::RButtonDown CGXGridCore::HitTest