CGXGridCore::OnStartSelection

virtual BOOL OnStartSelection(ROWCOL nRow, ROWCOL nCol, UINT flags, CPoint point);??

nRow

Specifies the row id.

nCol

Specifies the column id.

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.

point

Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.

Return Value

TRUE if the user can start selecting cells at the given cell; FALSE to prevent selecting cells.

Remarks

This method is called when the user has pressed the mouse in a cell and starts selecting cells.

You can override this method if you want to restrict the area where the user can select cells (you will then also have to override CanChangeSelection). If you want to disable selecting cells globally, you should call GetParam( )->EnableSelection(...).

Example

This example only allows selecting cells for rows 5 to 10:

BOOL CSampleView::OnStartSelection(ROWCOL nRow, ROWCOL nCol, UINT flags, CPoint point)
{
   nRow, nCol, point, flags;
   return nRow >= 5 && nRow <= 10;
}

See Also

 CGXGridCore::CanChangeSelection  CGXGridCore::OnChangedSelection  CGXGridParam::EnableSelection

CGXGridCore

 Class Overview |  Class Members