Print Page | Close Window

How to add combo box to toolbar in dialog?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=5227
Printed Date: 04 October 2024 at 3:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to add combo box to toolbar in dialog?
Posted By: jams_sony
Subject: How to add combo box to toolbar in dialog?
Date 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.



Replies:
Posted By: Oleg
Date 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


Posted By: jams_sony
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net