Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - How to add combo box to toolbar in dialog?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add combo box to toolbar in dialog?

 Post Reply Post Reply
Author
Message
jams_sony View Drop Down
Newbie
Newbie


Joined: 01 October 2006
Location: Canada
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote jams_sony Quote  Post ReplyReply Direct Link To This Post Topic: How to add combo box to toolbar in dialog?
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2006 at 12:26am
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
Back to Top
jams_sony View Drop Down
Newbie
Newbie


Joined: 01 October 2006
Location: Canada
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote jams_sony Quote  Post ReplyReply Direct Link To This Post Posted: 08 October 2006 at 2:40am
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.