Changing The Cursor in The OnHover Of a Field

JamesJoey

Registered User.
Local time
Today, 17:47
Joined
Dec 6, 2010
Messages
642
I want a field to be enabled but want to change the cursor from an I-Beam to either a hyperlink hand or a pointer.

Is this possible?
James
 
in vbe, insert, module,
paste the code below into the new module,
press F4, name the module: modCursor (optional)
Ctl-S , save the module

Code:
Option Compare Database
Option Explicit

Public Const IDC_APPSTARTING = 32650&
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&
Public Const IDC_CROSS = 32515&
Public Const IDC_IBEAM = 32513&
Public Const IDC_ICON = 32641&
Public Const IDC_NO = 32648&
Public Const IDC_SIZE = 32640&
Public Const IDC_SIZEALL = 32646&
Public Const IDC_SIZENESW = 32643&
Public Const IDC_SIZENS = 32645&
Public Const IDC_SIZENWSE = 32642&
Public Const IDC_SIZEWE = 32644&
Public Const IDC_UPARROW = 32516&
Public Const IDC_WAIT = 32514&


Private Declare Function LoadCursorLong Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long

Public Function SetMouseCursor(CursorType As Long)
  Dim hCursor As Long
  hCursor = LoadCursorLong(0&, CursorType)
  hCursor = SetCursor(hCursor)
End Function


then in the form design, select your text box,
press F4 (properties)
EVENT tab ,
in the ON MOUSE MOVE event, click the drop box,
select [EVENT PROCEDURE]

then paste to code below to call the cursor:
Code:
Private Sub TextBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SetMouseCursor IDC_HAND
End Sub
 
Worked great!

I wasn't sure if it was going to work with a split form datasheet but it did.

I was using the Display as Hyperlink=Screen Only but I was unable to get ris of the font underline. Looked funky... what ever that meas.

Thanks much,
James
 

Users who are viewing this thread

Back
Top Bottom