473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Ownerdraw Listbox Hit Check Issue

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

Nov 21 '05 #1
2 1417
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/downl...lllistener.zip

Ken
------------------
"Rlrcstr" <rl*****@msn.com> wrote in message
news:OF**************@TK2MSFTNGP12.phx.gbl...
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


Nov 21 '05 #2
Cool stuff. Thanks.
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Oi*************@TK2MSFTNGP12.phx.gbl...
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/downl...lllistener.zip

Ken
------------------
"Rlrcstr" <rl*****@msn.com> wrote in message
news:OF**************@TK2MSFTNGP12.phx.gbl...
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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew | last post by:
I'm having a major problem with a databound listbox in C#. In the constructor for the form I am trying to pre-select some of the items based in information in the database. When I step through the...
3
by: Thomas Kehl | last post by:
Hi. Does anybody have a sample, how does I can make a checkBox ownerdrawn? I need to change the color inside of the box. Can anyone help me, how does I have to do this? Thanks Thomas
0
by: Apollo440 | last post by:
If MenuItem.OwnerDraw Property is true,.NET framework does not recognize the overlapped accelerator keys. Is there a workaround? eg) +------+ |&Test | <- |&Tea | <- MenuItems has...
0
by: SirThanxALot | last post by:
Dear all, This is the situation: I have a custom subclass of ListBox - OnDrawItem overriden - OnSelectedIndexChanged overriden - DrawMode.OwnerDrawFixed (same issue with OwnerDrawVariable)...
1
by: Christopher | last post by:
Hi... I would be very grateful If You could resolve my question, my question is "How do tabular a ListBox that their property DrawMode is OwnerDrawFixe?". I do know as tabular a listbox, but I...
2
by: Peter Proost | last post by:
Hi, I've got the following ownerdraw menu: drag a mainmenu on a form and add some menuitems to it, set all the menuitems to ownerdraw = true and for every menuitem add this code (replace...
0
by: genojoe | last post by:
This code is derived from: ms-help://MS.VSCC.2003/MS.MSDNQTR.2005JUL.1033/cpref/html/frlrfSystemWindowsFormsMenuItemClassOwnerDrawTopic.htm The sample works as presented but does not contain a...
1
by: tmda | last post by:
I'm using OwnerDraw for some customization in my ListView - adding color to item backgrounds. I'm using the ListView specifically for it's OwnerDraw capability. I originally was using the...
1
by: John | last post by:
Using Access 2007 I find that, on opening a form, a listbox control always displays one of the values in the list, even if no value has been selected. Thus, the first value in the list is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.