Solved

How to insert controls into CToolBar?

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 35
Question regarding Copy/Paste 16 96
countEvens challenge 2 103
unix example issues 18 90
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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