Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody!

I hope in your help:)!

Please, consider following code (I think it's adequate for understanding my problem but I can eventually add other lines of code):
void CDialog::DoDataExchange(CDataExchange* pDX)
{
 CDialog::DoDataExchange(pDX);

  DDX_Control(pDX, IDC_COMBO, m_Combo);
  DDX_CBIndex(pDX, IDC_COMBO, m_ComboValue);
}

BOOL CDialog::OnInitDialog()
{
 CDialog::OnInitDialog();

 m_Combo.ShowWindow(SW_SHOW);

 FromMMToDlg();

 return TRUE;
}

void CDialog::FromMMToDlg()
{
 m_Combo.AddString("aaaa");
 m_Combo.AddString("bbbb");

 OnSelchangeCombo();
}

BEGIN_MESSAGE_MAP(CDialog, CDialog)
  ON_CBN_SELCHANGE(IDC_COMBO, OnSelchangeCombo)
END_MESSAGE_MAP()

void CDialog::OnSelchangeCombo()
{
 UpdateData(TRUE);

 switch(m_ComboValue)
 {
 case 0:
  // Part A
  break;
 case 1:
  // Part B
  break;
 }
}


The Combobox "Type" is "Drop List" and the Combobox "Owner Draw" is "No".
Why am not I able to made list box of the combobox visible?

Thanks!

Sergio
Posted
Updated 5-Apr-11 14:14pm
v2

One thing I would add: make sure you have sized the listbox of the combobox. You can do this in the resource editor by clicking on the dropdown arrow of the combobox, and then dragging the bottom center dragpoint down.
 
Share this answer
 
Comments
cammaratasergio 6-Apr-11 9:18am    
You're my savior:)!
Thanks a lot!
Hans Dietrich 6-Apr-11 10:10am    
You're welcome!
Albert Holguin 6-Apr-11 22:59pm    
Didn't think of this! ...probably only thing i DIDN'T mention... lol.. good catch Hans!
Hans Dietrich 6-Apr-11 23:31pm    
:) :) :) Personal experience - from staring at a dozens of comboboxes and wondering why the listbox wouldn't drop!
Albert Holguin 6-Apr-11 23:42pm    
actually, this has happened to me before, just didn't remember it... in my case, 28 feels like the new 40... :)
Make sure the "Visible" property is set to "True" (you don't have to explicitly call ShowWindow() if you did it that way). On a related note, you probably shouldn't call an event handler from InitDialog(). Other than that, your code should work as is... I'm assuming m_Combo is a CComboBox object right?

Also...
-Make sure your resource is still IDC_COMBO (I've changed this by accident before while looking through properties)
-In your resource header file, make sure IDC_COMBO has a unique number (otherwise you'll get all sorts of odd behavior)
-You did name your dialog something other than CDialog right (just making sure)?
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900