Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-06-18
5
Medium Priority
?
168 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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 …
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 lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

782 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