List Box Point-to-Select (MouseMove)

  • Thread starter Thread starter skeptic23
  • Start date Start date
S

skeptic23

I have a list box that shows files from my hard drive. I'd really like to
have it select the item being pointed to as I move my mouse pointer over it.
I have coded this and it works fine unless the list is scrolled. I need a
way to offset my list index to account for how far down the list has been
scrolled.

I can't find a list box property that will allow me to determine where a
scrolled list is positioned. Something giving me the list index of the first
visible row would do the trick. I haven't been able to find anything so far.

I've tried some VB code that uses the SendMessage API to extend the style of
the list box to do exactly what I'm after (point-to-select), but it doesn't
work. I think I'm running into the fact that Access list box controlss don't
have .hWnd properties to identify them to the API.

Any clever ideas out there?

Another nice feature that depends on point-to-select capability is displaying
tool tips specific to a selected row. See
http://www.codeguru.com/vb/controls/vb_listbox/article.php/c2767/

Thanks!
 
skeptic23 said:
I have a list box that shows files from my hard drive. I'd really like to
have it select the item being pointed to as I move my mouse pointer over it.
I have coded this and it works fine unless the list is scrolled. I need a
way to offset my list index to account for how far down the list has been
scrolled.

I can't find a list box property that will allow me to determine where a
scrolled list is positioned. Something giving me the list index of the first
visible row would do the trick. I haven't been able to find anything so far.

I've tried some VB code that uses the SendMessage API to extend the style of
the list box to do exactly what I'm after (point-to-select), but it doesn't
work. I think I'm running into the fact that Access list box controlss don't
have .hWnd properties to identify them to the API.

Any clever ideas out there?

Another nice feature that depends on point-to-select capability is displaying
tool tips specific to a selected row. See
http://www.codeguru.com/vb/controls/vb_listbox/article.php/c2767/


Your API idea is the way I have seen this kind of done. A
key point is that the ONLY time you can get a hWnd for an
Access control is when it has the focus.

Scrounge around in Stephen Lebans' site for example code
that you might be able to adapt to your needs. I think
these may be pertinate:
http://www.lebans.com/justicombo.htm
http://www.lebans.com/setgetsb.htm
http://www.lebans.com/tooltip.htm
 
Marshall...

BULLSEYE! The tooltip code was exactly what I was looking for.

Thanks so much, and now that I see what the real solution entails, I'm glad I
didn't try to take my crude attempt any farther. No API programmer here...
yet...

Thanks!
Millard

Marshall said:
I have a list box that shows files from my hard drive. I'd really like to
have it select the item being pointed to as I move my mouse pointer over it.
[quoted text clipped - 16 lines]

Your API idea is the way I have seen this kind of done. A
key point is that the ONLY time you can get a hWnd for an
Access control is when it has the focus.

Scrounge around in Stephen Lebans' site for example code
that you might be able to adapt to your needs. I think
these may be pertinate:
http://www.lebans.com/justicombo.htm
http://www.lebans.com/setgetsb.htm
http://www.lebans.com/tooltip.htm
 
I know what you mean about API programming. What little of
it I've done could not have been accomplished without
Stephen's web site. Be sure to put it in your
Favorites - Access folder along with the other invaluable
Access sites (too many to list, but there are a lot of links
to Related Sites on the Resource page at The Access Web
http://www.mvps.org/access/)
--
Marsh
MVP [MS Access]

Marshall...

BULLSEYE! The tooltip code was exactly what I was looking for.

Thanks so much, and now that I see what the real solution entails, I'm glad I
didn't try to take my crude attempt any farther. No API programmer here...
yet...


Marshall said:
I have a list box that shows files from my hard drive. I'd really like to
have it select the item being pointed to as I move my mouse pointer over it.
[quoted text clipped - 16 lines]

Your API idea is the way I have seen this kind of done. A
key point is that the ONLY time you can get a hWnd for an
Access control is when it has the focus.

Scrounge around in Stephen Lebans' site for example code
that you might be able to adapt to your needs. I think
these may be pertinate:
http://www.lebans.com/justicombo.htm
http://www.lebans.com/setgetsb.htm
http://www.lebans.com/tooltip.htm
 
Back
Top