Solved

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

Posted on 2001-06-18
5
162 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 69
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 468
either24  challenge 19 101
Window placement 17 85
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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