[AccessD] Is mouse Clicked?

MartyConnelly martyconnelly at shaw.ca
Thu May 4 15:10:48 CDT 2006


You could try some variation of this code. You may have middle button too.
Lots of VB methods and getkeystate on google

For mouseover (no button pressed) see
http://www.mvps.org/access/forms/frm0037.htm

> Public Declare Function GetKeyState Lib "user32" _
>     (ByVal nVirtKey As Long) As Integer
> Public Const VK_LBUTTON = &H1
> Public Const VK_RBUTTON = &H2
> Public Const VK_MBUTTON = &H4 

> Public Const KeyIsDown = &H8000&

On a textbox object in a form

Private Sub Text0_MouseDown(Button As Integer, Shift As Integer, X As 
Single, Y As Single)
 If (GetKeyState(VK_LBUTTON) And &H8000) Then
        Debug.Print "Left Button is Down"
Else
        Debug.Print "Left Button is Up"
End If
Debug.Print GetKeyState(VK_LBUTTON)
Debug.Print GetKeyState(VK_RBUTTON)
End Sub

Private Sub Text0_MouseMove(Button As Integer, Shift As Integer, X As 
Single, Y As Single)
Debug.Print GetKeyState(VK_LBUTTON)
Debug.Print GetKeyState(VK_RBUTTON)
End Sub

Mark A Matte wrote:

>Charlotte,
>
>I'm not trying to do the drag thing.  I have a number of objects on a 
>form...and as the mouse moves over these objects...I would like to do 
>something depending on whether the right, left, or neither button is held in 
>the down position.
>
>Thanks,
>
>Mark A. Matte
>
>
>  
>
>>From: "Charlotte Foust" <cfoust at infostatsystems.com>
>>Reply-To: Access Developers discussion and problem 
>>solving<accessd at databaseadvisors.com>
>>To: "Access Developers discussion and problem 
>>solving"<accessd at databaseadvisors.com>
>>Subject: Re: [AccessD] Is mouse Clicked?
>>Date: Thu, 4 May 2006 09:39:12 -0700
>>
>>What are you trying to accomplish?  If the mouse button is down at the
>>time is passes over an object, the click action already occurred
>>elsewhere and the behavior/meaning of the mouse activity has changed.
>>Are you trying for something like the click and drag you can do in
>>design view to select objects?
>>
>>
>>Charlotte Foust
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
>>Sent: Thursday, May 04, 2006 9:31 AM
>>To: accessd at databaseadvisors.com
>>Subject: [AccessD] Is mouse Clicked?
>>
>>Hello All,
>>
>>Is there a way when the mouse passes over an object on a form to tell if
>>the right or left mouse button is down?
>>
>>Thanks,
>>
>>Mark A. Matte
>>
>>
>>--
>>AccessD mailing list
>>AccessD at databaseadvisors.com
>>http://databaseadvisors.com/mailman/listinfo/accessd
>>Website: http://www.databaseadvisors.com
>>--
>>AccessD mailing list
>>AccessD at databaseadvisors.com
>>http://databaseadvisors.com/mailman/listinfo/accessd
>>Website: http://www.databaseadvisors.com
>>    
>>
>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list