Hi
How can I force the user to be only able to select a single cell in a MSHFlexGrid?
Currently they can click on a cell and then by holding the shift and selecting cursor keys they can select more than one cell at a time.
Thanks in advance
Printable View
Hi
How can I force the user to be only able to select a single cell in a MSHFlexGrid?
Currently they can click on a cell and then by holding the shift and selecting cursor keys they can select more than one cell at a time.
Thanks in advance
Bob
I have no experience in that regard, but perhaps you could
add the corresponding events to "detect" those situations,
and then add code in those events to essentially override what
would have otherwise normally occurred.
Spoo
Bob
OK, I now have a little experience :)
Maybe something like this:
The concept is to reset the RowSel (selected row) to alwaysCode:Private Sub FG1_KeyDown(KeyCode As Integer, Shift as Integer)
If Shift = 1 Then
If KeyCode = 40 Then ' down arrow
v1 = FG1.MouseRow
FG1.RowSel = v1
End If
End If
End Sub
be where the mouse pointer is (MouseRow), effectively killing
the effect of the down arrow key.
Hope that gives you something to play with.
Spoo
'Assumptions
'The grid is used for display purpose only
'Want to focus always in a single cell
'No other functions in the following events
'Demo 5:5 Rows:Cols
Code:Private Sub MSHFlexGrid1_EnterCell()
With MSHFlexGrid1
.HighLight = flexHighlightNever
.FocusRect = flexFocusHeavy
.Col = 4 ' change to desired Col
.Row = 2 ' change to desired Row
End With
End Sub
Private Sub MSHFlexGrid1_GotFocus()
MSHFlexGrid1_EnterCell
End Sub
Private Sub MSHFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
MSHFlexGrid1_EnterCell
End Sub
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
MSHFlexGrid1_EnterCell
End Sub