Solved

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

Posted on 2001-06-18
5
165 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

630 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