R
Robin Tucker
Hi there,
How can I determine if a list box item is visible or not (I mean visible
within the client context of the listbox).
Background -->
I am trying to implement an "image cache". My list box items are all owner
draw and display various images. Of course, when I have 1,000 items in the
list box, I don't want to go to the database and fetch from 1 to 1000 (too
slow), just to display items 300 to 320 in the list box. So what I'm doing
is requesting the image from the database thread in the OnDrawItem event and
then, when the thread executes a delegate to state that the item has been
fetched from the database, I'm "refreshing" the item on screen.
When the user scrolls the list box, I need to cancel requests for items that
are no longer visible (the database fetch thread no longer needs to fetch
them into the cache). I can do this by testing each request in the request
queue to see if its still visible in the listbox client area. Something
tells me GetItemRectangle is the key here, but I'm not sure.
How can I determine if a list box item is visible or not (I mean visible
within the client context of the listbox).
Background -->
I am trying to implement an "image cache". My list box items are all owner
draw and display various images. Of course, when I have 1,000 items in the
list box, I don't want to go to the database and fetch from 1 to 1000 (too
slow), just to display items 300 to 320 in the list box. So what I'm doing
is requesting the image from the database thread in the OnDrawItem event and
then, when the thread executes a delegate to state that the item has been
fetched from the database, I'm "refreshing" the item on screen.
When the user scrolls the list box, I need to cancel requests for items that
are no longer visible (the database fetch thread no longer needs to fetch
them into the cache). I can do this by testing each request in the request
queue to see if its still visible in the listbox client area. Something
tells me GetItemRectangle is the key here, but I'm not sure.