[Mono-bugs] [Bug 71950][Nor] New - ListBox GetItemRectangle index out of range errors.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 29 Jan 2005 14:13:32 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by rogerio.araujo@gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=71950

--- shadow/71950	2005-01-29 14:13:32.000000000 -0500
+++ shadow/71950.tmp.30503	2005-01-29 14:13:32.000000000 -0500
@@ -0,0 +1,51 @@
+Bug#: 71950
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: rogerio.araujo@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ListBox GetItemRectangle index out of range errors.
+
+Description of Problem:
+When i click in any item in the list box after clear it's contents i got
+the error : "GetItemRectangle index out of range errors."
+The selected_index and focused_item is not being set to -1 when the listbox
+clear yout contents using myListBox.Clear() as an effect of these variables
+no reset to -1 i getting some index out of range exceptions.
+
+Steps to reproduce the problem:
+1. Create a listbox and fill with some itens
+2. Add an event handled to selectedindexchanged
+3. Inside event handler clear the listbox and fill with less itens
+4. Click on any listbox item again
+5. The error will raise
+
+Actual Results:
+Index out of range errors.
+
+Expected Results:
+SelectedIndexChanged raised without errors
+
+How often does this happen? 
+All the time.
+
+Additional Information:
+This code fix some bug related with selectedindexchanged event not being
+raised after click in the first item in the listbox, clear and click in the
+first item again, please place this code at UpdateItemInfo internal method
+of ListBox:
+
+if (! adding && first == -1 && last == -1) {
+  selected_index = -1;
+  focused_item = -1;
+}