Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > ExpandableList Paint Bug
 

ExpandableList Paint Bug

1) Start IssueVision
2) in the middle pane select the top item in the second "Computer" group.
3) Then click on the last item in the above group "Telecommunications."
Notice you'll see the list "jump" and draw the Telecommunications group starting at the top, when the top of that section had scrolled off the screen.
It is disorienting to the user for their selection to be moved to a new location when they click on it.

Worse, if you adjust the data so that there is more than a full screen's worth of data in the top "Telecommunications" group and then follow the above instructions then the item you select will be scrolled completely off the screen as soon as you select it.
This is an unacceptable user experience.

I've looked all through the code trying to fix this bug, but I find no references to any scrollbars or anything else that looks like it would be helpful to keep the list from auto-scrolling.

Does anyone have any idea why this is happening or how to fix it?

MigrationUser 1  Sunday, February 13, 2005 7:59 PM
I was about to post yesterday that I was having the same problem.  We've use the IssueList as a base for a listview we've created and had the same exact issue in our control.  It was getting really frustrating because most cases we only had one group and would have 100 - 200 items in that group.  So the you would scroll to the bottom 200 items down and then click, of course the view would jump right back to the top.  

I think we've found a solution here to this problem.  It has to do when you click on a different section control.  That control becomes active.  When the active control changes and the AutoScroll is set to true it looks like a series of internal work happens that looks for the Top,Left point of the new active control.  Of course this doesn't always work well for this IssueVision control, because the Top/Left corner of the Section Control could be hundreds or thousands of pixels away from the item we just selected.  

To fix the prob. we ended up settling on making sure the control just didn't scroll at all when the active control changed.  This looks like the same behavior Outlook has.  To do this just add the following lines of code to the IssueList, or prob the ExpandableList:

protected override Point ScrollToControl(Control activeControl)
{
    return this.AutoScrollPosition;
}

It looks like that protected method is called each time the active control changes, and requests a new position to scroll to.  Rather than scrolling to the top/left of the control (which if you use Reflector you'll see the base class method does essentially), you can move to any point you wish.  We just decided to use the last scroll position so nothing moves.  
MigrationUser 1  Thursday, February 17, 2005 2:51 PM
no suitable method found to override...

Can you elaborate a litlle more ?

TIA,
~Gordon
MigrationUser 1  Friday, February 18, 2005 12:22 PM
I found this to work quite well if you put in SectionControl...

private const int WM_SETFOCUS = 0x0007;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_SETFOCUS:
this.Invalidate();
return;
}

base.WndProc(ref m);
}

HTH someone else,
~Gordon
MigrationUser 1  Friday, February 18, 2005 12:52 PM
Make sure you inherit from UserControl and not just Control.
MigrationUser 1  Friday, March 11, 2005 9:13 AM
You can inherit from 'Form' as well as 'UserControl' to make it work.
MigrationUser 1  Friday, March 11, 2005 10:33 AM

You can use google to search for other answers

Custom Search

More Threads

• Using VS Studio .NET vs. VS Studio .NET 2003 w/ Pocket PC TaskVision Client
• Express 2005 C# or VB
• Wanted someone with a suitable terrarium for herbivore introduction
• Cannot find "file:///D://.....". Make sure the path or the internet address is correct.
• Need Help
• Outlook 2003 Clone - Owner Drawn background Color problem
• Sea
• how to add array of buttons in a form
• WindowsApllications In Multithreading
• Windows service to Lock accounts in Database and Active Directory