Solved

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

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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Importing Special Characters in Dynamics GP Through Integration Manager 3 88
substring method in java 1 135
Window placement 17 95
Unix Command -- Challenging  question 7 101
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

713 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