[Mono-bugs] [Bug 477438] Virtual/ownerdraw Listview cant handle >16 item

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 18 17:56:44 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=477438

User calberto.cortez at gmail.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=477438#c1





--- Comment #1 from Carlos Alberto Cortez <calberto.cortez at gmail.com>  2009-02-18 15:56:43 MST ---
I tried the next sample, based on your description:

using System;
using System.Windows.Forms;

public class Test
{
        static void Main ()
        {
                Application.Run (new TestForm ());
        }
}

public class TestForm : Form
{
        ListView lv;
        ListViewItem [] items_cache;

        public TestForm ()
        {
                lv = new ListView ();
                lv.VirtualMode = true;
                lv.RetrieveVirtualItem += RetrieveVirtualItemHandler;
                lv.Dock = DockStyle.Fill;
                lv.Columns.Add ("One");
                lv.Columns.Add ("Two");
                lv.View = View.Details;
                lv.FullRowSelect = true;

                lv.OwnerDraw = true;
                lv.DrawItem += DrawListViewItemHandler;
                lv.DrawColumnHeader += DrawListViewColumnHeaderHandler;

                lv.VirtualListSize = 17;
                lv.Parent = this;
                items_cache = new ListViewItem [lv.VirtualListSize];
        }

        void DrawListViewColumnHeaderHandler (object o,
DrawListViewColumnHeaderEventArgs args)
        {
                args.DrawDefault = true;
        }

        void DrawListViewItemHandler (object o, DrawListViewItemEventArgs args)
        {
                args.DrawDefault = true;
        }

        void RetrieveVirtualItemHandler (object o, RetrieveVirtualItemEventArgs
args)
        {
                if (items_cache [args.ItemIndex] == null) {
                        ListViewItem item = new ListViewItem ("Item " +
args.ItemIndex);
                        item.SubItems.Add ("Sub item " + args.ItemIndex +
"-1");
                        items_cache [args.ItemIndex] = item;
                }

                args.Item = items_cache [args.ItemIndex];
        }
}

And it doesn't throw any exception (that's why it's *important* that our users
provide their test case, so we know the exact way to reproduce the issue).

Also, I fixed a bug like this one some months ago. What version are you using?

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list