The Listbox is called GrmLstBox for grammar list box.
The seven events I have CellKeyDown, GotFocus, KeyDown, MouseDown, MouseEnter, MouseExit, MouseUp.
I won’t bother to show CellKeyDown and KeyDown since they don’t have anything to do with mouse events.
BeingEdited is a property which is set to True when the relevant controls are turned to being editable.
The -1 value is in the very first few lines of MouseUp
GotFocus:+++++++++++++++++++++++++++++++
If BeingEdited Then
me.SelectedRowIndex = GrLstIdx
SetRTag()
Var ht As Integer = me.RowHeight * (me.LastRowIndex)
If ht > me.Top - self.Height - 22 Then
me.Height = self.Height - me.Top - 22
Else
me.Height = ht
End If
End If
Return// End of GotFocus ++++++++++++++++++++++++++++++++++
MouseDown
Return True
End of MouseDown+++++++++++++++++++++++++++++
Start of MouseUp ++++++++++++++++++++++++++++++++++
Var row As Integer = me.RowFromXY( x, y )
Var column As Integer = me.ColumnFromXY( x, y )
me.SelectedRowIndex = row
//row and column are -1 here
If row = 0 Then
me.CellTypeAt( row, column ) = Listbox.CellTypes.TextField
ElseIf row > 0 then
GrLstIdx = row //the row selected and saved for scrollposition
Var prp As Boolean = False
Var trsf As New RowGrmClass(MnStuff.GrXCnt)//the class which will fill the listbox with text.
Var rt As Integer = me.RowTagAt(me.SelectedRowIndex)
trsf = GrmInst.GetTrGrRw(rt, False )//the class
If -1 <> CREdit(kCGrmNt).Value.IndexOf(trsf.dagta(GrmCol)) Then prp = True////TextArea related to GrmLstBox
If prp And 7 = App.MyMsgBx( “Your Grammar Word is in the Field Already. Do You Wish to Continue?”, False, self ) Then Return//MyMsgBox is simply a MessageDialog
CREdit(kCGrmNt).Value = if( CREdit(kCGrmNt).Value.IsEmpty = False, CREdit(kCGrmNt).Value + "; " + trsf.dagta(GrmCol), trsf.dagta(GrmCol))
me.Selected(row) = True
CREdit(kCGrmNt).SetFocus//TextArea related to GrmLstBox
End If//me.SelectedRowIndex > 0 then
Return
End of MouseUp+++++++++++++++++++++++++++++++++
Start of MouseEnter ++++++++++++++++++++++++++++++++++++
If BeingEdited Then
me.SetFocus
me.SelectedRowIndex = GrLstIdx
me.Selected(me.SelectedRowIndex) = True
Var ht As Integer = me.RowHeight * (me.LastRowIndex)
If ht > me.Top - self.Height - 20 Then
Var ct As Integer = ( self.Height - me.Top - 20 ) \ me.RowHeight
ht = ct * me.RowHeight
me.Height = ht
End If
End If
Return
End of MouseEnter+++++++++++++++++++++++++++++++++++
Start of MouseExit++++++++++++++++++++++++++++++++++++
If me.RowHeight > 22 Then
me.Height = me.RowHeight
Else
me.Height = 22
End If
me.ScrollPosition = me.SelectedRowIndex
Return
End of MouseExit++++++++++++++++++++++++