ListBox Horizontal Scroll Position Question

  • Thread starter Thread starter Christine
  • Start date Start date
C

Christine

I am trying to detect which column the user clicked in a list box and
am able to do so when the listbox has not been horizontally scrolled.
I use the listbox columnwidths and the X to determine the column.

However, when the listbox is scrolled over to rightmost columns, then
my calculations do not work because the X is relative to the listbox
window. Is there some property I can access to tell me either how many
columns or how many pixels over the listbox is scrolled?

I have seen some mention of 'Scroll Thumb' in some posts but cannot
find anything in Access documentation on this. I suspect I need to use
some kind of Api call on the window, but do not know how.

Thanks in advance,
Christine
 
Christine I think you would be better of with a SubForm instead of
ListBox control. But if you must, there is code in the SetGetScrollBar
solution on my site showing you how to get the current horizontal
position of the ScrollBar Thumb for a Form. You would have to substitute
the ListBox hWnd for the Form's Hwnd. Now that I think about it though,
the SB for a Form is a separeate window while the SB for a ListBox
control is part of the window itself.

Post back if you need further help and we can work through this issue.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Thanks Stephan,
I will take a look at your SetGetScrollBar solution to see if I can
apply it to a ListBox, or not. Fortunately, this is not one of my
critical issues, just a 'nice to have' feature. I have been to your
site before and have always found great examples there.

Too bad there is not a ColumnIndex property to the ListBox, just like
the ListIndex property. Oh well, I am actually very fond of the
multi-column Listbox that Access offers. As I said - for once, it is
not a critical issue.

Regards,
Christine
 
Back
Top