A.D. Tejpal
adtp at airtelmail.in
Tue Jul 5 13:07:22 CDT 2011
You are most welcome Bill!
ps:
Last month you were seeking a solution for synchronized scrolling of a pair of subforms. Does the problem stand resolved ?
Best wishes,
A.D. Tejpal
------------
----- Original Message -----
From: William Benson (VBACreations.Com)
To: 'Access Developers discussion and problem solving'
Sent: Tuesday, July 05, 2011 17:31
Subject: Re: [AccessD] How to tell a button's "air space"is nolonger beinghovered over
I tried your code A.D., it works pretty well.
It occasionally misses when the button's edge is near the top (but not at
the top) of its section and when another control is near the button's edge..
But it's great, thank you.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D. Tejpal
Sent: Tuesday, July 05, 2011 5:10 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to tell a button's "air space" is nolonger
beinghovered over
Bill,
Apparently, in view of special positioning of control in question, you
are looking for a solution that is self contained within control's MouseMove
event. You could experiment with sample code given below:
' Code in form's module
'==============================
' Declarations section
Private gX As Single, gY As Single
'---------------------------------------------
Private Sub CmdTest_MouseMove( _
Button As Integer, _
Shift As Integer, _
X As Single, Y As Single)
With Me.CmdTest
Me.CmdTest.Caption = "Test (MM)"
If gX <> 0 Then
If (X > (0.9 * .Width) And X > gX) _
Or (X < (0.1 * .Width) And _
X < gX) Then
Me.CmdTest.Caption = "Test"
End If
End If
If gY <> 0 Then
If (Y > (0.9 * .Height) And Y > gY) _
Or (Y < (0.1 * .Height) And _
Y < gY) Then
Me.CmdTest.Caption = "Test"
End If
End If
End With
gX = X
gY = Y
End Sub
'==============================
Normal caption of command button named CmdTest is "Test". When mouse
pointer is brought over it, the caption changes to "Test (MM)". As & when
the mouse pointer moves away from the control, the caption reverts back to
normal, i.e. "Test".
Note:
(a) MouseMove event fires in rapid-fire style. Values for X and Y
returned by this event have a range from 0 upto the width and height (in
twips) of the control in question.
(b) The multiplying factors of 0.9 and 0.1 used in the sample code could
perhaps be fine tuned further (say 0.95 and 0.05) so as to narrow down the
twilight zone. However a coarser setting as adopted above, is found
conducive to more consistent behavior. This is because a deliberately wild
mouse sweep by the user can result in X or Y value getting truncated short
of the potential maximum, even though the mouse pointer has moved out.
Best wishes,
A.D. Tejpal
------------