Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to insert controls into CToolBar?

Posted on 1998-10-15
4
Medium Priority
?
444 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:Nightmare090197
ID: 1323356
Edited text of question
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1323357
Use a CDialogBar. CToolBar is just for buttons.
0
 
LVL 12

Accepted Solution

by:
migel earned 200 total points
ID: 1323358
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
ID: 1323359
oops.. sorry
m_wndToolBar.GetItemRect(2, &rect);
2 - index of the toolbar item
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

705 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