473,508 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capture Mouse Button States and Coordinates in custom function More options

Is there a way to capture all relevant info about the mouse, without
using Mouse Up/Down etc. procedures?

I'm trying to make a custom function and send it the mouse info on
the
click event.
For example:
I would like to set all the controls on a form to call the same
function and within that function grab the mouse state and then
process the info....
Set all controls On Mouse Up event to "=CustomMouseFunction()"
Public Function CustomMouseFunction()
'Get the mouse info here, is there an API or does Access
provide
this info?
if (the right mouse button was clicked) then
'process
endif
End Function
I've searched the groups for suggestions, but I cant seem to find
any.
Is there an API to get the Mouse button state? or Does Access provide
this info perhaps?
Thanks in Advance

Feb 21 '07 #1
2 5564
On Feb 21, 10:35 am, "cefran...@yahoo.com" <cefran...@yahoo.com>
wrote:
Is there a way to capture all relevant info about the mouse, without
using Mouse Up/Down etc. procedures?

I'm trying to make a custom function and send it the mouse info on
the
click event.

For example:

I would like to set all the controls on a form to call the same
function and within that function grab the mouse state and then
process the info....

Set all controls On Mouse Up event to "=CustomMouseFunction()"

Public Function CustomMouseFunction()
'Get the mouse info here, is there an API or does Access
provide
this info?
if (the right mouse button was clicked) then
'process
endif
End Function

I've searched the groups for suggestions, but I cant seem to find
any.

Is there an API to get the Mouse button state? or Does Access provide
this info perhaps?

Thanks in Advance

The Mouse events would tell you the button state, but getting the
location is a bit trickier. Access screen co-ordinates do not directly
relate to the values you'd get from an API. I'm not aware of a way to
have one function run for any control event except to call it from a
control event. In this case you would would know the control the mouse
is over.

If you must know the x,y search for the useage of GetCursorPos and
ClientToScreen APIs. You should be able to make something work from
those. Sorry, I don't have all thier details with me right now.

Feb 21 '07 #2
What you are trying to do - have a bunch of controls call the same
function - is best accomplished using delegages. The only problem is
that delegates is an object oriented mechanism currently not supported
in any version of Access. Here is how you would do something like that
in VB2005
]
Dim arrTxt() As TextBox

arrTxt = New Textbox(){text0, text1, text2, text3}
For Each txt As Textbox in arrTxt
AddHandler txt.Enter, AddressOf YourCustomSub
Next

For Each txt As TextBox In arrTxt
AddHandler txt.MouseClick, AddressOf MouseClick_Thing
Next

Private Sub YourCustomSub(ByVal sender As Object, ByVal e As System
EventArgs)
'--do stuff
End Sub

Private Sut MouseClick_Thing(ByVal sender As Object, e As
System.Windows.Forms.MouseEventArgs)
Console.Writeline(e.X.ToString() & " " & e.Y.ToString())
End Sub
In MouseClick_Thing you can use the e object to capture the coordinates
of the Mouse as in e.X and e.Y. There are several other properties you
can captuer for the mosue. But that is in OOP land.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Feb 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2720
by: Marcia Gulesian | last post by:
How can I capture the event when I click (focus) with the cursor anywhere in the page (that is, on a component or elsewhere). This event would occur in an I.E 5.5 or later browser.
4
14689
by: Jay | last post by:
Hi, How can I capture mouse position on Image? I found number of script capturing mouse position of the page. But I could not find anything based on image. What I want to find out is X Y...
4
3639
by: masantha wee | last post by:
Hi all, I am using Firefox and embedding Javascript in html. I understand that we can use mouse events by coding them in the body of html (by creating a button or anything and by adding in the...
3
3591
by: mitsura | last post by:
Hi, I have included a small listing. The test program opens a panel and show a bitmap. What I want is to when the mouse is over the bitmap panel, I want to trap the left mouse click. The...
2
19571
by: quickcur | last post by:
Hi, I have html like this: <div id="myCanvas" style="border:10px, black;position:relative;height:250px;width:100%;"> <img id="p" src="p.jpg"> </div> When user click the mosue, I would like ...
1
2072
by: finerrecliner | last post by:
trying to get the mouse coordinates to show up in an alert box. but all i get is "undefined" the script should work like: click the button, then click anywhere on the page to show your current x...
3
3752
by: Morten Snedker | last post by:
If I have a number of random applications open, move the mouse cursor to a given position and do a click, the application gets the focus. That is what this simple code should illustrate: Dim...
4
2885
by: =?Utf-8?B?Unlhbg==?= | last post by:
I have a winform containing a scrollable panel and a groupbox inside the panel. There is a button inside the groupbox. When that button is clicked; how do I capture and display the X and Y...
4
3486
by: mbatestblrock | last post by:
I hope this makes some sense. My ultimate goal here is to execute a block of code if the mouse has not moved in a minute or so within the broswer. The machine I am running this on is for internal...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.