|
-
Jun 17th, 2011, 09:45 AM
#1
Thread Starter
Junior Member
[RESOLVED] MSHFlexGrid. Select single cell only
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
-
Jun 17th, 2011, 10:01 AM
#2
Re: MSHFlexGrid. Select single cell only
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
-
Jun 17th, 2011, 10:23 AM
#3
Re: MSHFlexGrid. Select single cell only
Bob
OK, I now have a little experience 
Maybe something like this:
Code:
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
The concept is to reset the RowSel (selected row) to always
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
-
Jun 17th, 2011, 03:18 PM
#4
Lively Member
Re: MSHFlexGrid. Select single cell only
'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
Last edited by Stupidiot; Jun 17th, 2011 at 03:21 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|