From: Louis-Pierre Beaumont on
Thank you Joseph,

That answers my question. Im going to use a grid instead of a Listbox as you
advised. I really don't want to handle repositioning + the repainting the
controls myself.

"Joseph M. Newcomer" wrote:

> 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: Louis-Pierre Beaumont on
Wow Tom,

That sample exactly doest what i want to do, it hosts a CDialog into a cell!
:)

Thank you for all this precious help!


"Tom Serface" wrote:

> 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
> >
>
> .
>