Mouse Over to Select Record in Continuous Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a drag and drop routine that works great in single form view but I cannot get it to drop onto the right control when using continuous form. The routine uses the mouse move event to identify the control that should receive the drop. When I drop the value on the control in continuous form view, it drops on the currently selected record's control instead of the control of the record the mouse is over. Is there a way to identify which record the mouse is over?
 
Have a look how I do it here:
http://www.lebans.com/conformscurcontrol.htm
ContinuousFormsCurrentRow.zip is a class that allows you to
programmatically access the contents of a bound control, as the user
moves their Mouse, but the control does not have the focus. For Forms in
Continuous View.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Jerry Perez said:
I have a drag and drop routine that works great in single form view
but I cannot get it to drop onto the right control when using continuous
form. The routine uses the mouse move event to identify the control
that should receive the drop. When I drop the value on the control in
continuous form view, it drops on the currently selected record's
control instead of the control of the record the mouse is over. Is
there a way to identify which record the mouse is over?
 
Thank you. Since the class returns the row number under
the mouse I should be able to use the selTop to make it
the current record and drop the contents to the control
under the mouse.
 
fIsScrollBar is the only thing keeping it from working with the current Access. This is the fix:

'==== Scrollbar constants
Const SB_CTL As Long = 2
Const SB_BOTH As Long = 3
Const SB_VERT As Long = 1 ' &H1 (32 bit)
Const SB_VERT64_0 As Long = 1107296257 ' &H42000001 (64 bit - invisible)
Const SB_VERT64_1 As Long = 1375731713 ' &H52000001 (64 bit - visible)
Const SB_HORZ64_0 As Long = 1107296256 ' &H42000000 (64 bit - invisible)
Const SB_HORZ64_1 As Long = 1375731712 ' &H52000000 (64 bit - visible)

'**** Return Vertical ScrollBar's hWnd
Private Function fIsScrollBar(frm As Form) As Long

Dim hWnd_VSB As Long
Dim hWnd As Long
Dim strCls As String
Dim lngWindowLong As Long


' Default to SORRY - NO Vertical ScrollBar control
' is currently visible for this Form
fIsScrollBar = -1


hWnd = frm.hWnd

' Let's get first Child Window of the FORM
hWnd_VSB = apiGetWindow(hWnd, GW_CHILD)

' Let's walk through every sibling window of the Form until it finds a vertical scroll bar
While hWnd_VSB <> 0 And fIsScrollBar = -1
' Thanks to Terry Kreft for explaining
' why the apiGetParent acll is not required.
' Terry is in a Class by himself! :-)
'If apiGetParent(hWnd_VSB) <> hWnd Then Exit Do

strCls = fGetClassName(hWnd_VSB) 'Get class of this hwnd
If strCls = "scrollBar" Or strCls = "NUIScrollbar" Then 'If it is a scrollbar then see which type it is
'==== Determine if Horizontal or Vertical -- looking for vertical
lngWindowLong = apiGetWindowLong(hWnd_VSB, GWL_STYLE)
If (lngWindowLong And SBS_VERT) Or lngWindowLong = SB_VERT Or lngWindowLong = SB_VERT64_0 Or lngWindowLong = SB_VERT64_1 Then
fIsScrollBar = hWnd_VSB 'Will terminate the loop
End If
End If

' Let's get the NEXT SIBLING Window
hWnd_VSB = apiGetWindow(hWnd_VSB, GW_HWNDNEXT)

Wend

End Function
 
Back
Top