Solved

How to insert controls into CToolBar?

Posted on 1998-10-15
4
440 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 50 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

617 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