Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / March 2005

Tip: Looking for answers? Try searching our database.

ListView changes scroll position when it shouldn't

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Aaron Pfeifer - 31 Mar 2005 01:20 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.