![]() |
How to add combo box to toolbar in dialog? |
Post Reply ![]() |
Author | |
jams_sony ![]() Newbie ![]() Joined: 01 October 2006 Location: Canada Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() Posted: 05 October 2006 at 11:44am |
Hi,
As I know, if my application is based on MDI or SDI, then I can add combo box to toolbar by implementing OnCreateControl like below
if (lpCreateControl->nID == ID_EDIT_STATE
&& pToolBar->GetBarID() == IDR_MAINFRAME)
{ CXTPControlComboBox* pComboState = (CXTPControlComboBox*) CXTPControlComboBox::CreateObject();
pComboState->AddString(_T("Debug")); pComboState->AddString(_T("Release")); pComboState->AddString(_T("Configuration Manager")); pComboState->SetDropDownWidth(150); lpCreateControl->pControl = pComboState;
return TRUE; } Unfortunately, my application is based on dialog, I don't know how to
add combo box to toolbar. Would any guy be so kind to help me?
Generally speaking, there is very few samples for dialog, it is realy a pity. For example, I would like to add tooltip for menu to statusbar in dialog, I also found no example in the samples. If anyone could give me some instruction, I would realy appreciate it.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
See DialogSample. All same methods can be used for DIalog.
you can manually add Combo to toolbar you need:
CXTPControlComboBox* pComboState = (CXTPControlComboBox*)toolbar.GetControls()->Add(xtpControlComboBox, Id);
...
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jams_sony ![]() Newbie ![]() Joined: 01 October 2006 Location: Canada Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Thanks for your help. But I have some question else.
1. How can I add a CXTComboBoxEx instead of CXTPControlComboBox to the toolbar? For example, how can I add a address bar to toolbar in dialog. it seems that xtpControlComboBox don't present CXTComboBoxEx.
So the follow code didn't work for this case.
CXTComboBoxEx* pComboBox = (CXTComboBoxEx*) m_wndToolBar.GetControls()->Add(xtpControlComboBox, IDC_ADDRESSBAR, _T("Address"), 0, TRUE);
2. After I add combobox, if the focus is in combobox but mouse move over other toolbar button, there is no color effect on the button unless I remove focus from the combobox. Could you please teach me how to correct it?
Thanks for your help in advance.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |