Problem with CSizingControlBar class

Ah hello.

I am using a class I was pointed to in another of my questions:

also at

and I am trying to add a listbox control to example 1.  

So, in CMyBar::OnCreate, I add


to the end, and change the definition of m_wndChild to be a CListBox not CEdit.

I never get the string displayed however.

What the heck am I doing wrong ?

LVL 19
Who is Participating?
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
Isn't ES_MULTILINE and ES_WANTRETURN used for edit controls?  (You might be turning off something by mistake)
AndyAinscowFreelance programmer / ConsultantCommented:
Does the list box display?

What is the return value of m_wndChild.AddString("String"); ?

Does it work if you keep it as a CEdit ? (m_wndChild.SetWindowText("String"); )
Jaime OlivaresSoftware ArchitectCommented:
CSizingCtrlBar is designed to manage CView derived objects, if you want to use CEdit, CListBox or any other, you have to create a CView derived object first and declare many child controls for it.
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

mrwad99Author Commented:
>> Does the list box display?


>> What is the return value of m_wndChild.AddString("String"); ?

0 through to N-1, where N is the number of calls to AddString.  It is never LB_ERR.

>> Does it work if you keep it as a CEdit ? (m_wndChild.SetWindowText("String"); )

>> ...if you want to use CEdit, CListBox or any other, you have to create ...

Yes, it all works fine when it is a CEdit.  It is just CListBox that plays up.

AndyAinscowFreelance programmer / ConsultantCommented:


mrwad99Author Commented:
No that still does not do anything.  Full code:

CListBox m_wndListBox;

int COutputBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
      if (CSizingControlBarG::OnCreate(lpCreateStruct) == -1)
            return -1;

            ES_WANTRETURN|ES_AUTOVSCROLL, CRect(110,110,110,110), this, 1233543))
            return -1;

      m_wndListBox.ModifyStyleEx(0, WS_EX_CLIENTEDGE);

      if ( m_wndListBox.AddString(_T("First item")) == LB_ERR)

      return 0;

mrwad99Author Commented:
Hehe.  Whoops.

Thanks :)
mrwad99Author Commented:
While we are on the subject Andy, I have a similar question at http:Q_21409541.html that Jaime commented on to give the above pre-defined class, but I wanted to see how it could be done with splitter windows.  Could you comment on the problem I found ?

AndyAinscowFreelance programmer / ConsultantCommented:
I've just had a look at the other question.
I'll think about it (eg. when walking the dog this evening - prime time, serious - no kids to distract me) but I have a feeling I won't be able contribute anything useful.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.