Simon Pettman
March 31st, 1999, 04:04 AM
Why does it not drop down a list.
Im creating a new ToolBar with a ComboBox on it.
In the resource editor I have added buttons to a new toolbar for the control and added the following code to the
OnCreate() function in CMainFrame.
*** m_wndToolBar2.Create(this,WS_CHILD|WS_VISIBLE|CBRS_TOP,IDR_FREQ_TOOL)
*** m_wndToolBar2.LoadToolBar(IDR_FREQ_TOOL)
Then to attach the Combo box.
*** while(m_wndToolBar2.GetItemID(index)!=ID_FREQ_TOOL_COMBO)
*** index++;
*** m_wndToolBar2.SetButtonInfo(index,ID_FREQ_TOOL_COMBO,
*** TBBS_SEPARATOR,250);
*** m_wndToolBar2.GetItemRect(index,&rect);
*** m_wndToolBar2.m_comboFreq.Create(WS_CHILD|
*** WS_VISIBLE|WS_VSCROLL| WS_GROUP| CBS_DROPDOWNLIST,rect,
*** (CWnd*) &m_wndToolBar2,ID_FREQ_TOOL_COMBO);
This seems fine.
In the CToolBar derived class I have added a member function to create the list in the Combo.
*** BOOL CFreqTool::PopulateCombo(int noOfFreqs, float freqInc)
*** {
*** for (int freq=0; freq<noOfFreqs ; freq++)
*** {
*** CString text;
*** text.Format("%.2f",freq*freqInc);
*** m_comboFreq.AddString(text);
*** }
*** return TRUE;
*** }
And called this class from the document when the data to fill the list becomes available.
*** CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
*** pFrame->m_wndToolBar2.PopulateCombo(m_maxFreqNum,m_freqIncrements);
Running the Debbugger suggests that all is well at this point.
However when I click on the control to view the list it does not drop down anything.
The data is in the list because if you press any numbers you get the data appearing in the edit box.
What do you think I could be missing?
Simon Pettman
Research Engnineer
Goodmans Loudspeakers Ltd
pettman.s@gll.co.uk
Im creating a new ToolBar with a ComboBox on it.
In the resource editor I have added buttons to a new toolbar for the control and added the following code to the
OnCreate() function in CMainFrame.
*** m_wndToolBar2.Create(this,WS_CHILD|WS_VISIBLE|CBRS_TOP,IDR_FREQ_TOOL)
*** m_wndToolBar2.LoadToolBar(IDR_FREQ_TOOL)
Then to attach the Combo box.
*** while(m_wndToolBar2.GetItemID(index)!=ID_FREQ_TOOL_COMBO)
*** index++;
*** m_wndToolBar2.SetButtonInfo(index,ID_FREQ_TOOL_COMBO,
*** TBBS_SEPARATOR,250);
*** m_wndToolBar2.GetItemRect(index,&rect);
*** m_wndToolBar2.m_comboFreq.Create(WS_CHILD|
*** WS_VISIBLE|WS_VSCROLL| WS_GROUP| CBS_DROPDOWNLIST,rect,
*** (CWnd*) &m_wndToolBar2,ID_FREQ_TOOL_COMBO);
This seems fine.
In the CToolBar derived class I have added a member function to create the list in the Combo.
*** BOOL CFreqTool::PopulateCombo(int noOfFreqs, float freqInc)
*** {
*** for (int freq=0; freq<noOfFreqs ; freq++)
*** {
*** CString text;
*** text.Format("%.2f",freq*freqInc);
*** m_comboFreq.AddString(text);
*** }
*** return TRUE;
*** }
And called this class from the document when the data to fill the list becomes available.
*** CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
*** pFrame->m_wndToolBar2.PopulateCombo(m_maxFreqNum,m_freqIncrements);
Running the Debbugger suggests that all is well at this point.
However when I click on the control to view the list it does not drop down anything.
The data is in the list because if you press any numbers you get the data appearing in the edit box.
What do you think I could be missing?
Simon Pettman
Research Engnineer
Goodmans Loudspeakers Ltd
pettman.s@gll.co.uk