So here's the scenario:
I've got 2 ListViews, one above the other. These are
inside of a ScrollableControl. When the 2 ListViews are
large enough, they cause the ScrollableControl to display a
vertical scrollbar. The problem comes in when I change the
focus from one ListView to another. I do NOT want the
scroll position to automatically adjust itself to display
the top part of the focused ListView. I want the focus to
change, but the scroll position to remain the same. I
can't seem to figure out how to do this, while keeping the
focus functionality the same.
For example, I can replace WM_SETFOCUS messages with a call
to Invalidate(), but this will prevent the items in the
ListView from appear focused, although I certainly could
send a message to the listview indicating to display the
item as focused, though I don't really like this way. Any
suggestions?
Aaron Pfeifer - 31 Mar 2005 03:47 GMT
Well I decided to go with the long way around it and
overriding WM_FOCUS events in WndProc() so that it will not
process focus events, but just Invalidate() instead.
Then, since selected items will not appear focused, I
p/invoke the selected items to take the state of an item
which is being dragged over. The result of this is that it
is selected, it contains the highlighted blue area, and
appears focused to the user. As well, the control won't be
scrolled into view when the user clicks on it.
If anyone has any other suggestions about getting around
the problem, feel free to reply. Thanks in advance.