Solved

Basic Question: Combo box won't show list when click the arrow

Posted on 2001-06-18
5
158 Views
Last Modified: 2013-11-20
Hello,

  I added a Combo box from Visual C++ toolbox to my dialog and created a member variable (CComboBox m_MacCombo;). In OnInitDialog(), I added two strings to the combo box
(m_MacCombo.AddString("Test 0");
 m_MacCombo.AddString("Test 1");)

  I expected to see two strings when I clicked the arrow on the combo box. But nothing showed in the combo box. Do I need to do something else? Thanks.
0
Comment
Question by:qwang73
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:emily_hall
ID: 6204406
Hi
I tried this out and I only got nothing in the combo box when I did not add the call to the parent function
CDialog::OnInitDialog();  into my OnInitDialog before adding the two strings to the combo box...

so make sure you have something like this:

BOOL CMyDialog::OnInitDialog
{
    CDialog::OnInitDialog();
    m_MacCombo.AddString("Test 0");
    m_MacCombo.AddString("Test 1");
}

:) emily
0
 

Author Comment

by:qwang73
ID: 6204505
Emily,

  Thanks for your comment. But there was a call to the parent function CDialog::OnInitDialog() in my OnInitDialog(). Actually AppWizard generated most of the OnInitDialog() code. All I did was adding those two lines.

  Any other suggestions?

Nancy
0
 
LVL 2

Accepted Solution

by:
mirec earned 50 total points
ID: 6205442
Go to the resource editor and resize combo box's height.
m.
0
 
LVL 2

Expert Comment

by:mirec
ID: 6205463
You can also use this code for resizing:

CWnd* pwndCombo = GetDlgItem(IDC_MYCOMBO);

CRect wndRect;
pwndCombo->GetWindowRect(&wndRect);

pwndCombo->SetWindowPos(NULL, 0, 0, wndRect.Width(), wndRect.Height()+50, SWP_NOMOVE);

m.
0
 

Author Comment

by:qwang73
ID: 6207544
Mirec,

  That's it. I didn't make the combo box tall enough. Thanks for your help.

Nancy
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sameEnds challenge 3 107
Hibernate methods 2 58
Doc'in system (example?) BA 7 78
countEvens challenge 2 58
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now