• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 77
  • Last Modified:

MS Access anyway to know the specific location of your field on a continuous form?

Hi Experts,

My client had asked me to simulate a hover event on a continuous form where what pops up would show information specific to the field that the mouse is hovering over. This could not be done on a continuous form because the control you're hovering over might not be the currently selected record. Make sense?

So I'm trying an alternative where when a control is clicked on in this continuous form, I grab the X and Y coordinates and open a small form right above the control that was entered. I know I can grab the X and Y from the mouse down event, but how do I then position a non modal pop up form right above that control.

Any help would be greatly appreciated

Thanks.
0
eantar
Asked:
eantar
  • 5
  • 3
  • 2
  • +2
1 Solution
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
0
 
Dale FyeCommented:
The problem with doing this in the mousemove event is that event is constantly firing, mine fires even if I just bump my desk.  If you can determine what control it is over, you could perform some form of logic test to determine how long you have been hovering over the control and if the mouse has moved outside of that control, and only open the popup if the mouse has remained over the same control for some specified period of time, and then close the popup when the mouse moves outside that control.

However, if your question is how do you move the popup, then what I would do is save the X and Y values of the mouse in a tempvar in the mouse move event.1

Tempvars!X = X
Tempvars!Y = Y

and then use the Form_Open event and the Form.Move method to position the form whereever you want it based upon those tempvars.

me.Move X+ XOffset, Y + YOffset
0
 
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
I would say, that in theory its possible, with the link that Ferruccio provided, but I would not really recommend it. It could quickly become a time sink for you, to make sure everything is working and every quirk of it it ironed out. I remember trying to do something like this, but there was just too many small issues that never seemed quite right about it. Small issues like the form not closing if the mouse focus was moved to quickly away from the subform, or if the subform scrolled while doing a mouseover, and ....

I would recommend instead a button "more info" on the continous form that users could click and then popup a form with that information. More control, might not be as pretty or "web-like" as you would like, but simple to implement.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
eantarAuthor Commented:
Hey thanks all, there doesn't seem to be a good way to do this.

So here's what I'm wondering: If I use the MouseDown event of the control to capture the X and Y coordinates on a continuous form, is there a way to open up a hidden form and move that form next to the X and Y coordinates. The X and Y coordinates seem to be the X and Y relative to the control, not the Application Window. Any idea how I could figure that out???

Dale, I think you might be close, but I don't know what the Offsets would be.

Thanks all.
0
 
Dale FyeCommented:
It's been a long time since I tried to play with the X,Y coordinate system.

I'm guessing you would need to use Screen.ActiveControl.Name to get the name of the active control (or active form).  Then look for the top and left coordinates of that object.  Then check to see whether that object has a parent (this would generally be a form, but might be a tab control), get the top and left properties of that object, and iterate until you reach the parent form, and get the top and left properties of the parent form, then add all of those Top and Left properties together to determine the actual top/left position of the control on the screen.

I have not tested this, but I also found:

http://www.tek-tips.com/viewthread.cfm?qid=629332
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Just to clarify; you want the user to be able to hover over any cell (row/column) of a continuous form and pop-up something related to the data in that cell?

Jim.
0
 
eantarAuthor Commented:
That was the original intent. But I didn't think it was possible. Is it?
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<< Is it?>>

 I'm not 100% positive...I have to go back and look at some work I did in the past.    But first, I wanted to make sure I understood what you were asking for.

 It seems however that it is, and this would be along the lines of what the others suggested; get where the cursor is, where that is in relation to the form, where that is in relation to...etc.

 The tricky part is "what row am I on?".    I did some work on that and was able to calculate the current row.  But I need to look at exactly what I did.

Personally I like Anders idea<g>, but it's interesting enough that I might tackle it.

Jim.
0
 
eantarAuthor Commented:
Hey Jim,

If you come up with something, I'd love to hear about it. Either as a hover over the value in the row I hover over, or if clicked on, top pop a small window at that locations that would disappear when you EXIT the control.

Keep me posted.
0
 
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
You are correct. The X and Y are the coordinates in relation to the control. This can tell you whether you clicked the right part of the control, or the left part, but doesn't tell you anything about where you are on the screen. You could look at the application window, and the form, and then the control, to calculate where you should show your popup, but I've found it easier to use windows API to simply get the mouseposition on the screen. I look forward to seeing if someone comes up with something, but I don't have the time myself to tinker with it right now.
0
 
eantarAuthor Commented:
Thank you Anders, I found some code that uses the Windows API, but how do I translate that into a Form Move. Do I subtract the Application Top and Left to get the position on the form?
0
 
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
I found some time to create this example. It uses some GUI code written by Jack Leach over at utteraccess.

Is that what you are looking for?
DemoPopup.zip
0
 
eantarAuthor Commented:
Hey Andres. Sorry I've been away, but this looks like it just might do it. Thank you. I'll look further into this and give it a try. Best Eddie.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now