Hello,
The thread has developed quite extensively and I should take some time to digest what is being offered.
In regards to the actual use case of my problem:
I am writing a function to set a "drop down" search on any given textbox object. Go to the top of your browser and begin searching in your chrome browser (or any browser created in the last 20 years) you'll see what I am trying to develop - a recent search type of dropdown that is "queried" on change. Because Access offers no native solution to make this even remotely easy, I must use a listbox and do some code magic.
To answer your question in your head at the current time: No a combobox wont work - Because the arrow is disgusting and there is no clean way to remove it. Nonetheless, its just inferior to a listbox in this problem.
Getting the listbox to drop on the textbox object right below it is the easy part. The difficult part is selecting the items in the listbox as the cursor "hovers" over this. The only solution to my knowledge at the current time is to manually input AT LEAST ONE XY cordinate for the textbox and in conjuction use the XY cordinate grabber on a mousemove event. The rest of the items can be calculated easily based on textsize.
Suppose I am desiring to implement this code on many textbox objects throughout my project, I'd prefer not to waste my time with having to hard-code the XY cordinates of the listbox, as that is cumbersome
I slapped this together and works OK with some glitches but works by passing one XY arg:
Code:
Private Sub lbTest_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call listboxSelector(lbTest, GetYCursorPos, 314)
End Sub
---------------------
Private Sub listboxSelector(lbox As ListBox, YCursorPos As Long, yTop As Long)
Dim txtSizePixConst As Long
Dim i As Integer
Dim ArrPos() As Variant
txtSizePixConst = 15
If lbox.ListCount = 0 Then Exit Sub
ReDim ArrPos(1 To lbox.ListCount)
For i = 1 To lbox.ListCount
ArrPos(i) = (i * txtSizePixConst) + yTop
Next
For i = 1 To lbox.ListCount
Select Case i
Case 1
If YCursorPos >= yTop Then
lbox.Selected(i) = True
End If
Case 2 To lbox.ListCount
If YCursorPos >= ArrPos(i - 1) And YCursorPos <= ArrPos(i) Then
lbox.Selected(i) = True
End If
End Select
Next
I looked at isladogs code and saw no reference to any XY API, so I dismissed it as just .TOP / .LEFT properties being used for whatever his application served as.
I did not take into account the purpose of the database so I will revisit it with a more thorough check and see if I can make it work for my needs. Will report back.
Thank you all.