Hi Isladogs. Thanks for your reply and sample.
First, some comments and replies:
I guess i don't really understand the question. Select = Highlight. Highlighting and selecting are synonymous in terms of code:I agree that the listbox item can be highlighted using mouse move (it was in my example as well)
What I'm unsure about is how to select that item just using mouse move
Is that covered in listboxselector? Otherwise if I've missed it and your code does that, please can you tell me where it is
To be clear on my end, at any time where i've said "select" I am referring to the above code.Code:listbox.selected(5) = True
It is true I am discrete and with good reason. I know Access pretty well in terms of what controls can and cannot do and what tricks you can do to make them cool, it appears you do as well.From the start, you have seemed VERY reluctant to pass on full details of your intentions! It would be much more useful if you gave a clear statement of intent
Recent searches in the Access app or recent browser searches? Or something else entirely?
Either way, rather than me reinvent the wheel, it would indeed make sense for you to provide code you've already done
If i thought there was another solution, I would've asked specifically for that in my OP. Again, I don't see how the content of the listbox is contributing to the problem, but i'll pass an SQL string to the procedure from a query of recent searches. I.e. User searches for "UID103983" consistently - that gets populated in the listbox to save the user time. Standard concept today. The only alternative I can ponder is using a combo-box, which defeats this entire post. But I don't believe I can permanently hide the dropdown arrow. When a control gets focus, it comes to the front. So its frustrating, but frustration is a result of my stubbornness and strict requirements, I suppose. All the code is in the latest sample I provided. Oh and i do apologize for accidentally including junk code. I forgot to remove when I exported...
In regards to the Twips to Px conversion, it is rounded, but hardly. Lets assume the dropdown listbox will never exceed 5 inches (quite a generous assumption) - Over 5 inches, my error results in:
True conversion at 5 inches = 96 * 5 = 480 pixels
My conversion at 5 inches = (1440 * 96) * 0.0666667 = 480.00024
... I am losing 2.4 ten-thousandths of a pixel in error. Enough to never be a concern. Of course, when the code is ironed out, I will use the proper conversion to eliminate any doubt.
But you are indeed correct that my code does not account for display change scale, because I simply don't understand all the variables that go into determining the XY pixel location even minutely as well as you do.
So I looked at the new sample you provided. You should know there are some errors that just stemmed from confusion passing database back and fourth.
In every instance where the form was referenced, the old form was referenced. So I would re-verify that you are actually getting the correct results. Every label in the code is under the old form because they were not changed and this will obviously show false results.
Forms("Main_Form") should be Forms("Main Form_1"). I would just delete the "Main Form".
If these are correct, and the labels are aligning to one another, the listboxselector should work and highlight lbTest as the mouse moves over it.
Honestly, If I can understand every single entire variable that goes into determine the XY position of a control, I can easily write some code to check for each condition (is the ribbon hidden? Is the window maximized? Is there a record selector?)...
See attached. I've developed a cleaner form for you and I to examine these counterparts. I welcome you to use it and see if you can develop something that is consistent if you hide/show ribbon, remove header, change header, etc.
To give some more info...
1.) Floating forms (pop-up) would be nice to have this feature but if we can only make it work within the app window, I am OK with that.
2.) If the app window is minimized or resized, I will probably just disable this feature - but if its a simple matter of using a resize event or something then might as well include it.
3.) I only need Y Axis cords, but X-Axis would be valuable for the sake of the community.
Regards