No replies re VirtualMode ListView controls

?

--

No replies to the previous query. (Is no one using VirtualMode?)
The problem, again:

CheckBoxes don't appear when ListView controls are placed in
VirtualMode. They are 'there'...just not displayed. One 'user fix' was
posted on CodeProject; the ListView was set to owner draw, and the
checkboxes are checked, then unchecked. An odd thing to be forced to
do.

Unfortunately, the owner-draw fix causes headers to not be displayed
when in Details mode. Anyone know a simpler way to force checkboxes to
display without requiring owner-draw?

This does seem like a bug in ListView's VirtualMode. I can't imagine
any logical reason why checkboxes would not be displayed.
 
?

--

The only "previous query" I see, you sent only five minutes before the
message to which I'm replying.

I'm not sure what kind of forum you think this is, but you will find
people more interested in helping you if you can demonstrate more patience
than that.

Peter, I posted the question three days ago. ("No checkboxes for
Virtual ListViews" or something like that.) That's why I said there
were no replies...usually three days means it wasn't noticed and isn't
going to be.

My other more recent post was in regard to drawing headers for
owner-drawn Listboxes, which relates to regular listboxes as well as
VirtualMode. Related, but different question (see below).
As for the specific issue you're asking about, in nearly every case,
asking a question about why your code doesn't work without posting an
actual concise-but-complete code sample that reliably demonstrates the
problem isn't going to do you any good. Your question here seems like a
perfect example of that.

I use the forms designer, which generates a lot of extraneous code, so
I thought that posting all of that would be extravagant for a problem
that (I assume) is known.

As the concept is very simple, it's easier to just explain it. Anyone
who has used virtual mode well enough to answer this already knows the
drill: If you drag a ListView to a form and set CheckBoxes and
VirtualMode, the checkboxes don't appear.

This article on CodeProject explains it:

http://www.codeproject.com/KB/list/ListViewVirtualMode.aspx

From the article:

void SetupListview(bool blnVirtual)
{
...
this.listView1.VirtualMode = true;
this.listView1.RetrieveVirtualItem +=
new
RetrieveVirtualItemEventHandler(listView_RetrieveVirtualItem);
...
}

void listView_RetrieveVirtualItem(object sender,
RetrieveVirtualItemEventArgs e)
{
// e contains ItemIndex
e.Item = listViewItem;
}

Unfortunately, the article doesn't address Details view, in which the
header comes into play. Hence the tangential query: If I can get
checkboxes to show up without setting owner-draw, then the problem is
solved.

But if that's an inherent bug in ListView (?) then I'd need to use
owner-draw, in which case the header doesn't get displayed (at least
with the simple code-fragment that I had posted).

The latter occurs even with non-VirtualMode ListViews, so again, it's
just a matter of dragging a ListView and setting OwnerDraw and
Details, with the other code fragment that I had already posted:

void listView_DrawItem(object sender, DrawListViewItemEventArgs e)
{
e.DrawDefault = true;
}

I trust that explains things a bit better. Thanks for your patience.
<g>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top