Solved

How to insert controls into CToolBar?

Posted on 1998-10-15
4
387 Views
Last Modified: 2013-11-20
How to insert controls (like CComboBox) into CToolBar?
Now I'm inserting CComboBox calling CComboBox::Create(), but I can't insert buttons after CComboBox.
0
Comment
Question by:Nightmare090197
  • 2
4 Comments
 

Author Comment

by:Nightmare090197
Comment Utility
Edited text of question
0
 
LVL 6

Expert Comment

by:snoegler
Comment Utility
Use a CDialogBar. CToolBar is just for buttons.
0
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
Comment Utility
to add control into CToolBar you must perform two steps:
1.in ToolBar resource define 3 separators/per control
[]___[][][] ([]- button _ separator) control will appear after first button) two additional separators are for create free space between buttons and control.
2.when you create toolbar just resize appropriate separator and place control into separators rectangle:
// typically this code is placed in the CMainFrame::OnCreate function
// IDW_COMBO - identifier of the combobox
// m_wndToolBar - your CToollBar
//
//

// this code must be called after createion m_wndToolBar
// Create the combo box
m_wndTollBar.SetButtonInfo(2, IDW_COMBO, TBBS_SEPARATOR, 100);

CRect rect;
m_wndStyleBar.GetItemRect(2, &rect);
rect.top = 3;
rect.bottom = rect.top + 100;
if (!m_wndComboBox.Create(CBS_DROPDOWNLIST|WS_VISIBLE|WS_TABSTOP,
                  rect, &m_wndToolBar, IDW_COMBO))
{
      TRACE0("Failed to create combo-box\n");
      return FALSE;
}



0
 
LVL 12

Expert Comment

by:migel
Comment Utility
oops.. sorry
m_wndToolBar.GetItemRect(2, &rect);
2 - index of the toolbar item
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now