Ownerdraw Listbox Hit Check Issue

R

Rlrcstr

I'm rolling my own with a listbox. The items in the list box are of varying
sizes and I'm hit checking when the litbox is checked to see what portion of
an item the user has clicked on.

Mostly it works fine. The only issue I'm running into is when the item that
th users clicks is at the bottom of the listbox and is not completely
displayed. When the user clicks there the listbox autoscrolls the full item
into view. That would be great except for the fact that the mousedown event
report where the user clicked and doesn't transpose it to account for the
fact that the list has been scrolled. Net effect is that I end up detecting
the wrong item.

I have a way to crrect it with the exception of the last item. Seems that
if there is any white space after the last item in the list (due to variable
size ownerdraw) the listbox reports that you clicked the last item even if
you clicked in the white space.

How can you tell when a list has been (or is being) scrolled? Thanks.

Jerry
 
K

Ken Tucker [MVP]

Hi,

I have been working on an extender that uses the nativewindows class
to recieve scroll events. It will work with any control. Set
addscrollevents to true to be notified of the events. Maybe this will help.

http://www.onteorasoftware.com/downloads/scrolllistener.zip

Ken
------------------
I'm rolling my own with a listbox. The items in the list box are of varying
sizes and I'm hit checking when the litbox is checked to see what portion of
an item the user has clicked on.

Mostly it works fine. The only issue I'm running into is when the item that
th users clicks is at the bottom of the listbox and is not completely
displayed. When the user clicks there the listbox autoscrolls the full item
into view. That would be great except for the fact that the mousedown event
report where the user clicked and doesn't transpose it to account for the
fact that the list has been scrolled. Net effect is that I end up detecting
the wrong item.

I have a way to crrect it with the exception of the last item. Seems that
if there is any white space after the last item in the list (due to variable
size ownerdraw) the listbox reports that you clicked the last item even if
you clicked in the white space.

How can you tell when a list has been (or is being) scrolled? Thanks.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

set itemheight in listbox 3
Refresh Listbox from Other Form 8
Listbox questions 3
Hittest on listbox? 2
Listbox not clearing 3
Listbox Drag-n-Drop 1
Force Listbox 1
Force Listbox to Refresh 5

Top