On Mouse Move Event

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
 
G

Guest

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

- Igor
 
J

JamesJ

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
 
G

Guest

Maek sure this is a stand-along label. Ie. thsi label is not assosiated with
a control.
 
D

Dirk Goldgar

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)
 
J

JamesJ

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)
 
G

Guest

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top