?
Solved

Problem with CSizingControlBar class

Posted on 2005-05-03
9
Medium Priority
?
275 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:mrwad99
  • 4
  • 4
9 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 13917512
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
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13917725
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
 
LVL 19

Author Comment

by:mrwad99
ID: 13918204
>> 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 45

Expert Comment

by:AndyAinscow
ID: 13918412
Longshot

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

0
 
LVL 19

Author Comment

by:mrwad99
ID: 13918467
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
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 13918593
Isn't ES_MULTILINE and ES_WANTRETURN used for edit controls?  (You might be turning off something by mistake)
0
 
LVL 19

Author Comment

by:mrwad99
ID: 13918656
Hehe.  Whoops.

Thanks :)
0
 
LVL 19

Author Comment

by:mrwad99
ID: 13918679
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
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 13918734
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Loops Section Overview
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question