On Mouse Move Event

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

Hi. I've searched a couple places, and have been unsuccessful, in
finding code that will change the mouse pointer going over a label
as it does going over a hyperlink.

Thanks,
James
 
Just define OnMouseClick property, and the cursor will turn into a hadn with
a finger. You do not need MouseMove

- Igor
 
For one thing the label doesn't appear to have a OnMouseClick property.
It has an OnClick property but the pointer doesn't change. I put the
following
code in the form's module:

Private Sub lblClose_OnMouseClick()

DoCmd.Close

End Sub

The popinter doesn't change and the DoCnd.Close doesn't fire.
No errors, nothing.

James
 
JamesJ said:
Hi. I've searched a couple places, and have been unsuccessful, in
finding code that will change the mouse pointer going over a label
as it does going over a hyperlink.

You can use the code from

http://www.mvps.org/access/api/api0044.htm
API: Displaying a custom Mouse icon

to change the mouse pointer in the label's MouseMove event. If you copy
and paste that code into a new standard module, you can then call the
MouseCursor function from your event procedure like this:

'----- start of example event procedure -----
Private Sub Label0_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)

MouseCursor IDC_HAND

End Sub

'----- end of example event procedure -----

Or else just set the OnMouseMove event property to

=MouseCursor(32649)
 
Works fine. Thanks much.

James

Dirk Goldgar said:
You can use the code from

http://www.mvps.org/access/api/api0044.htm
API: Displaying a custom Mouse icon

to change the mouse pointer in the label's MouseMove event. If you copy
and paste that code into a new standard module, you can then call the
MouseCursor function from your event procedure like this:

'----- start of example event procedure -----
Private Sub Label0_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)

MouseCursor IDC_HAND

End Sub

'----- end of example event procedure -----

Or else just set the OnMouseMove event property to

=MouseCursor(32649)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Sorry. You are right.

I copied my laebl from some sample database by MS and forgot about it. I
remember that unassociated labels (unlike associated labels) get their own
MouseMove events. I confused the two.

The other person's reply was correct.

- Igor
 
Here is an alternative (now I'ev played with Access a bit and know more):

Just define an unattached label. Then, in properties, enter a single spaec
in "Hyperlink sub-address" field. That's all!

WARNING (just had been bitten by this): If you plan to add an event to the
label (why else would you need this behavior?), make sure that the label is
NOT in a sub-form! Othwerwise, the value of the controls that belong to that
sub-form you reference in the handler for the event will have undefined
values (ok, edfined but certainly not in the way you'd expect).

SOLUTION for sub-forms:
Use a text box instead of the label and format it to look like label
(transparent background, no borders, correct size, etc). You can designate a
text box to be a "Hyperlink". THE CATCH: You must have it a bound tetx box!
(unbound one will not do). So the in form data source, just define an extra
column to contain the text you want the "label" to have and bind the "label"
textbox to that column.
 
Back
Top