Problem with CSizingControlBar class

Ah hello.

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

http://www.codeproject.com/docking/sizecbar.asp

also at

http://www.datamekanix.com/download/sizecbar-v2.44.zip

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

So, in CMyBar::OnCreate, I add

m_wndChild.AddString("String");

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 ?

TIA
LVL 19
mrwad99Asked:
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)
0
 
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"); )
0
 
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.
0
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?

Yes.

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

?
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Longshot

m_wndChild.AddString("String");
m_wndChild.Invalidate();
m_wndChild.UpdateWindow();

0
 
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;

      SetSCBStyle(GetSCBStyle() | SCBS_SHOWEDGES | SCBS_SIZECHILD);
      if (!m_wndListBox.Create(WS_CHILD|LBS_HASSTRINGS|WS_VISIBLE|ES_MULTILINE|
            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)
            TRACE("Problem\n");

      m_wndListBox.Invalidate();
      m_wndListBox.UpdateWindow();
      return 0;
}

Grrr.....
0
 
mrwad99Author Commented:
Hehe.  Whoops.

Thanks :)
0
 
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 ?

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