From: Louis-Pierre Beaumont Louis-Pierre on
Hello,

I would like to know if it is possible to customize a CListBox to base it's
items on child dialog resources (like CPaneDialog does, or better, like
ListBox ItemDataTemplate in WPF).

I find custom draw or owner draw too painfull to implement, and hard to
extend and reuse.

Regards,

Louis-Pierre Beaumont

From: Tom Serface on
I'm not sure exactly what you're looking for, but perhaps an article like:

http://www.codeproject.com/KB/combobox/xlistbox.aspx
http://www.codersource.net/mfc_clistbox_owner_draw_picture.html

Could help get you started...

Tom

"Louis-Pierre Beaumont" <Louis-Pierre Beaumont(a)discussions.microsoft.com>
wrote in message news:216F03AA-57FF-44F8-8D3D-62A5C1394895(a)microsoft.com...
> Hello,
>
> I would like to know if it is possible to customize a CListBox to base
> it's
> items on child dialog resources (like CPaneDialog does, or better, like
> ListBox ItemDataTemplate in WPF).
>
> I find custom draw or owner draw too painfull to implement, and hard to
> extend and reuse.
>
> Regards,
>
> Louis-Pierre Beaumont
>

From: Joseph M. Newcomer on
Well, I find custom draw/owner draw rather trivial most of the time. Once you get the
template for doing it, you just repeat-as-necessary. Getting the template right the first
time can be a struggle, but I've basically written only one owner-draw listbox/combobox,
and find copy-and-paste a fine technology for dealing with it.

That said, you can put child controls in a listbox; I've done it several times. It is a
bit tricky, and a bit painful, and a good deal more painful than owner-draw nearly all the
time.

The trick is partly in designating the listbox as a control parent (WS_EX_CONTROLPARENT),
and partly in how you handle the messages from the children. Alas, most of the code I
have that does this is proprietary and I can't give out samples. You have to do a lot of
SetWindowPos calls to handle the scrolling. But it is doable; I've put edit controls,
radio buttons, check boxes, and combo boxes into list boxes.

But I'm not sure a listbox is your best choice. Using a grid control might be a better
choice because these features are built into grid controls. So I'd look into a grid
control instead of trying to re-invent the technique (my technique was invented in the
late 1990s)
joe

On Tue, 3 Nov 2009 08:35:01 -0800, Louis-Pierre Beaumont <Louis-Pierre
Beaumont(a)discussions.microsoft.com> wrote:

>Hello,
>
>I would like to know if it is possible to customize a CListBox to base it's
>items on child dialog resources (like CPaneDialog does, or better, like
>ListBox ItemDataTemplate in WPF).
>
>I find custom draw or owner draw too painfull to implement, and hard to
>extend and reuse.
>
>Regards,
>
>Louis-Pierre Beaumont
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Tom Serface on
It's also really easy to put controls into "cells" in list controls. There
are tons of examples of doing it. A grid is more geared toward doing this,
but more trouble to manage as well.

I wasn't exactly sure what OP was looking for ...

As you know, but for OPs benefit in case they are reading this post as well,
there are tons of articles on extending or adding controls to the CListCtrl,
for example:

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

Tom

"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
news:fll1f59vddimpeo2bpfmh22pl0r4hn8drr(a)4ax.com...
> Well, I find custom draw/owner draw rather trivial most of the time. Once
> you get the
> template for doing it, you just repeat-as-necessary. Getting the template
> right the first
> time can be a struggle, but I've basically written only one owner-draw
> listbox/combobox,
> and find copy-and-paste a fine technology for dealing with it.
>
> That said, you can put child controls in a listbox; I've done it several
> times. It is a
> bit tricky, and a bit painful, and a good deal more painful than
> owner-draw nearly all the
> time.
>
> The trick is partly in designating the listbox as a control parent
> (WS_EX_CONTROLPARENT),
> and partly in how you handle the messages from the children. Alas, most
> of the code I
> have that does this is proprietary and I can't give out samples. You have
> to do a lot of
> SetWindowPos calls to handle the scrolling. But it is doable; I've put
> edit controls,
> radio buttons, check boxes, and combo boxes into list boxes.
>
> But I'm not sure a listbox is your best choice. Using a grid control
> might be a better
> choice because these features are built into grid controls. So I'd look
> into a grid
> control instead of trying to re-invent the technique (my technique was
> invented in the
> late 1990s)
> joe
>

From: Louis-Pierre Beaumont on
Thanks you for the links Tom,

I already found the second one you gave me. For now, thats what im doing.
But i would really like an "easy way" to integrate dialogs into listboxes.

Thank you :)

"Tom Serface" wrote:

> I'm not sure exactly what you're looking for, but perhaps an article like:
>
> http://www.codeproject.com/KB/combobox/xlistbox.aspx
> http://www.codersource.net/mfc_clistbox_owner_draw_picture.html
>
> Could help get you started...
>
> Tom
>
> "Louis-Pierre Beaumont" <Louis-Pierre Beaumont(a)discussions.microsoft.com>
> wrote in message news:216F03AA-57FF-44F8-8D3D-62A5C1394895(a)microsoft.com...
> > Hello,
> >
> > I would like to know if it is possible to customize a CListBox to base
> > it's
> > items on child dialog resources (like CPaneDialog does, or better, like
> > ListBox ItemDataTemplate in WPF).
> >
> > I find custom draw or owner draw too painfull to implement, and hard to
> > extend and reuse.
> >
> > Regards,
> >
> > Louis-Pierre Beaumont
> >
>