Hired a coder from FreeLancer a few month ago to write
Code for a keno game. Can no longer find him.
There are 80 numbers on the keno board.
The numbers are selected by dragging the mouse over the numbers.
this happens no matter which numbers are selected not just the first 5
In the jpg I have selected the first 5 numbers by dragging the mouse.
The problem arrises when dragging to unselect the numbers.The wrong numbers are displayed in the cells. It works correctly when clicking the indivual cells to unselect them. but dragging displays the problem(see jpg)
this happens no matter which numbers are selected not just the first 5
I think it is inthe following code which is beyond my abilities.
![Name: Keno Drag Problem.jpg
Views: 46
Size: 59.4 KB]()
Code for a keno game. Can no longer find him.
There are 80 numbers on the keno board.
The numbers are selected by dragging the mouse over the numbers.
this happens no matter which numbers are selected not just the first 5
In the jpg I have selected the first 5 numbers by dragging the mouse.
The problem arrises when dragging to unselect the numbers.The wrong numbers are displayed in the cells. It works correctly when clicking the indivual cells to unselect them. but dragging displays the problem(see jpg)
this happens no matter which numbers are selected not just the first 5
I think it is inthe following code which is beyond my abilities.
Code:
Private Sub DeSelectCurrentBoard()
Dim iRow As Integer, iCol As Integer
With flexBoardSelector
If mCurrentBoardIndex > 0 Then
CellFromIndex mCurrentBoardIndex, iRow, iCol
.Row = iRow: .Col = iCol
.CellBackColor = vbWhite
End If
End With
End Sub
Private Sub flexKenoBoard_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Dim OverCentreX As Boolean, OverCentreY As Boolean, ValidMouseOver As Boolean
Dim thisIndex As Integer
With flexKenoBoard
OverCentreX = Abs(Y - (.RowPos(.MouseRow) + (BOARD_CELL_WIDTH / 2))) < CELL_MOUSE_SENSITIVITY
OverCentreY = Abs(X - (.ColPos(.MouseCol) + (BOARD_CELL_WIDTH / 2))) < CELL_MOUSE_SENSITIVITY
ValidMouseOver = OverCentreX And OverCentreY
If ValidMouseOver And mranddonenobet = False Then
thisIndex = IndexFromCell(flexKenoBoard.MouseRow, flexKenoBoard.MouseCol)
'Store the card value to available for reuse - KVS - v1.x
clval = thisIndex
UpdateNumber IndexFromCell(.MouseRow, .MouseCol), X, Y, False
End If
End With
End Sub
Private Sub flexKenoBoard_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisIndex As Integer
If Button = vbLeftButton Then
thisIndex = IndexFromCell(flexKenoBoard.MouseRow, flexKenoBoard.MouseCol)
'Store the card value to available for reuse - KVS - v1.x
clval = thisIndex
mSelecting = Not KenoNumbers(thisIndex).Selected
UpdateNumber thisIndex, X, Y, True
End If
End Sub
Private Sub UpdateNumber(pindex As Integer, pX As Single, pY As Single, Optional pInitialiseDrag As Boolean = False)
Dim lRow As Integer, lCol As Integer, lBorderColour As Long, lForeColour As Long
Dim thisImage As StdPicture
If mCurrentBoardIndex = 0 Then Exit Sub 'Check this KVS
'to check Bet before selecting numbers - KVS - v1.8
' If KenoBoards(mCurrentBoardIndex).Stake = 0 And KenoBoards(mCurrentBoardIndex).SelectedCount = 0 Then
' MsgBox "No bet placed"
' Exit Sub
' End If
If KenoBoards(mCurrentBoardIndex).SelectedCount = MAX_SELECTIONS And mSelecting Then
Exit Sub
End If
If mranddonenobet = True Then
If mSavedfileIsDirty = False Then
mNewBetPlaced = True
mSavedfileIsDirty = True 'To check Save or NOT
Call Save_tofile_Write_INI
If mIsDirty = False Then
mNewBetPlaced = False
Exit Sub 'User clicked Cancel
Else
mranddonenobet = False
mNewBetPlaced = False
Call Clear_gridCardStats
pInitialiseDrag = False
End If
End If
End If
'KVS - v2.9.1
If pInitialiseDrag Then
flexKenoBoard.Drag vbBeginDrag
End If
If mSelecting = KenoNumbers(pindex).Selected Then
'Nothing to do - item is already selected or unselected
Else
KenoNumbers(pindex).AssignedLetters = Replace(KenoNumbers(pindex).AssignedLetters, KenoBoards(mCurrentBoardIndex).Letter, vbNullString)
'Set the selected Char to the variable - KVS - v1.x
sel_text_val = KenoBoards(mCurrentBoardIndex).Letter
CellFromIndex pindex, lRow, lCol
If mSelecting Then
lBorderColour = KenoBoards(mCurrentBoardIndex).Colour
lForeColour = vbWhite
KenoNumbers(pindex).AssignedLetters = KenoNumbers(pindex).AssignedLetters & KenoBoards(mCurrentBoardIndex).Letter
KenoBoards(mCurrentBoardIndex).SelectedCount = KenoBoards(mCurrentBoardIndex).SelectedCount + 1
Set thisImage = imgBlueSpot.Picture
'As user have to make bet before selecting a number - KVS - v1.8
' If KenoBoards(mCurrentBoardIndex).Stake = 0 Then
' cmdBetMore_Click
' End If
Else
lBorderColour = vbWhite
lForeColour = vbBlack
KenoBoards(mCurrentBoardIndex).SelectedCount = KenoBoards(mCurrentBoardIndex).SelectedCount - 1
Set thisImage = imgCellBG.Picture
'Reset the value back - KVS - v1.x
flexKenoBoard.Text = clval
End If
With flexKenoBoard
.Row = lRow: .Col = lCol
.RowSel = lRow: .ColSel = lCol
Set .CellPicture = thisImage
.Text = clval
'If click, set the text to selected Char - KVS - v1.x
If mSelecting Then .Text = sel_text_val
.CellBackColor = lBorderColour
.CellForeColor = lForeColour
End With
KenoNumbers(pindex).Selected = mSelecting
flexStatus.TextMatrix(KenoBoards(mCurrentBoardIndex).Index, 2) = IIf(KenoBoards(mCurrentBoardIndex).SelectedCount > 0, KenoBoards(mCurrentBoardIndex).SelectedCount, vbNullString)
'To load flexonecard when clicking the letter for which numbers are selected already - KVS - V1.6
If FlexOneCard.Visible = True And flexStatus.TextMatrix(KenoBoards(mCurrentBoardIndex).Index, 1) <> "" Then
Call flexoncecard_upd(flexStatus.TextMatrix(KenoBoards(mCurrentBoardIndex).Index, 1), mCurrentBoardIndex, KenoBoards(mCurrentBoardIndex).SelectedCount)
'lblRuns.Caption = 0 'KVS - v2.6
gridCardStats.TextMatrix(5, 1) = 0
End If
PlaySoundData SoundSelect(0), 0, SND_MEMORY Or SND_ASYNC Or SND_NODEFAULT
End If
If getCardCountSelected >= 2 Then
Call ShowOneCard
Else
'Its showing ALL flex grid while selcting the numbers for the first letter - KVS - V1.6
'Call ShowAllCards
'Added to show flexgrip for single card selection - KVS - V1.6
Call ShowOneCard
End If
Call DisplayCardsPlayed
End Sub
Private Function getCardCountSelected() As Integer
Dim i As Integer
Dim lCount As Integer
lCount = 0
For i = 1 To 20
If KenoBoards(i).SelectedCount > 0 Then
lCount = lCount + 1
End If
Next i