Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

The Ultimate Toolbox FAQ

0.00/5 (No votes)
5 Oct 2007 1  
A selection of frequently asked questions submitted by users of the Ultimate Toolbox

Visit the Ultimate Toolbox main page for an overview and configuration guide to the Ultimate Toolbox library.

Contents

Introduction

We've placed some answers here to a few of the most common questions folks have asked about when using various aspects of the Ultimate Toolbox.

If you've come across an issue with the Ultimate Toolbox that needed a work-around or a bit of documentation that didn't quite explain all the ins and outs of a particular function call, please feel free to submit it for inclusion � you can be pretty sure it will be of help to someone else out there!

Note: Some of the answers below will refer to sample projects included in the download above � these are not part of the main sample download for the toolbox, and should be unzipped to the same directory as the main downloads, creating a Faq subdirectory in the main Ultimate Toolbox dir.

Frequently Asked Questions

Why does my docking dialog dock below the status bar? (09/19/2000)

Q: When my docking dialog is docked to the bottom of my MDI application the status bar appears to be above. What is going on?

A: To make the status bar appear at the bottom you need to create status bar right after creating the CMainFrame and before all other child windows like dialog bars etc... The reason for this is because the MFC function CWnd::RepositionBars() iterates through all child windows to adjust their position and starts from the first child. So, the status bar has to be first child.

Can I use COX3DtabViewContainer in dialog based app? (07/24/2003)

Q: Is it possible to use the COX3DTabViewContainer in a dialog based app?

A: Yes � have a look at the Faq\3DDlgTab sample in the download.

Screenshot - 3DDlgTab.jpg
The 3DDlgTab sample in action.

Using controls (custom buttons) inside of COXCoolToolBar. (09/28/2000)

Q: How do I insert a control in a toolbar, particularly in COXCoolToolBar?

A: These are the steps required:

class CMainFrame : public CFrameWnd     
{           
    ....           
        COXCustomTBButtonWnd m_editCB;
    ....     
}
CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{ 
    // after creating the toolbar add these lines


    int nWidth=80; //width of the edit box 


    //try to insert our edit box in global array of custom buttons


    nIndex=m_wndToolBar.AddCustomButton(&m_editCB, IDC_CBEDIT, nWidth);

    if(nIndex==-1)
        return -1;
    nPosition=2;    //position in the toolbar desired 



    //you can do it this way for edit box   


    VERIFY(m_wndToolBar.InsertEditBox(nPosition, nIndex));

    //or this way for any control, but make sure to specify fourth parameter - class name



    VERIFY(m_wndToolBar.InsertCustomButton(nPosition,nIndex,WS_CHILD  | 
        WS_VISIBLE,0,_T("Edit")));
    ....

See also the Faq\CustomButtons sample in the UltimateToolboxFaq_samples download accompanying this article.

Cool controls in a dialog bar. (11/27/2000)

Q: How do I use cool controls in a dialog bar?

A: It is similar to using cool controls in a dialog, but with some exceptions.

Steps to include cool controls in a dialog bar:

  1. Create template for the dialog bar in the resource editor.
  2. On this dialog bar place the common controls you want.
  3. Go to Class Wizard and derive your own class from CDialogBar.
  4. Add variables for controls you've placed on dialog bar template. Example: if you want a cool edit:
class CMyDialogBar : public CDialogBar
{
   ....
   COXCoolCtrl m_edit;
   ....
}
  1. Add virtual function DoDataExchange() and code the body of the function:
void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
{
    CDialogBar::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_EDIT, m_edit);   
}
  1. Copy the declaration of the CDialogBar::Create() function and write in the body of the function:
BOOL CMyDialogBar::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID)
{
    if (!CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID))
        return FALSE;
    // call DoDataExchange() when subclassing the cool controls


    UpdateData(FALSE);
    return TRUE;
}
  1. Common steps for any dialog bar:

    Include a variable of the CMyDialogBar type in CMainFrame (for SDI/MDI projects) and call create in the OnCreate() handler for CMainFrame.

    NOTE: To use buttons as cool controls don't forget to define a handler for these buttons in order to enable the button! See article Q98198 in the MS KB "CDialogBar Button Enabled When Command Handler Present"

    See also the Faq\CoolDlgBar sample in the UltimateToolboxFaq_samples download accompanying this article.

Creating splitter window inside COX3DTabViewContainer. (07/20/2000)

Q. I want to create a splitter window inside COX3DTabViewContainer. How can I do it?

A: Declare the two variables - CSplitterWnd and COX3DTabViewContainer - in your CView derived class. In the views OnCreate() function create the COX3DTabViewContainer, then the CSplitterWnd, then create the panes of the splitter, and finally add the splitter to the pages of the COX3DTabViewContainer.

See also the Faq\SplitInTab sample in the faq samples download.

Screenshot - SplitInTab.jpg
The SplitInTab sample showing a splitter in one tab.

Simulating Delphi environment. (06/19/2000)

Q. I want to create application that has many separated child windows and no main owner window (looks like Delphi environment). How can I do It?

A: You can do this by creating all child dialog windows with CDialog::CreateIndirect() function.

We've provided a sample in the faq samples download in the Faq\DelphiLikeApp directory.

Selecting and deselecting items in COXShortcutBar. (06/02/2000)

Q. I have 3 groups in the COXShortcutBar. And when one item is selected in one group I want the selected items in the other groups to be unselected. What function should I use to accomplish that?

A: To do that you have to clear the selections in all inactive groups, add the following function to your COXShortcutBar derived class and call this function for all these groups when a selection is made:

void SetGroupSel( int group, int selItem = -1 );
void CShortCutBar::SetGroupSel( int group, int selItem )
{
    HSHBGROUP hGroup;
    hGroup = m_shortcut.FindGroupByOrder(group);
    m_shortcut.GetGroupListCtrl(hGroup)->ActivateItem(selItem);
}

Using Customize Manager in SDI application. (06/01/2000)

Q. I want to use Customize Manager in SDI application, but could not get it to work. What's wrong?

A: There are some points to follow to implement COXCustomizeManager, as described in the help chm. One of the points is that you have to explicitly assign the main app window before initializing the CustomizeManager pages:

AfxGetApp()->m_pMainWnd=this;

#ifdef OX_CUSTOMIZE_TOOLBARS    
    VERIFY(m_customizeManager.InitializeToolbars());    
#endif   //OX_CUSTOMIZE_TOOLBARS    


#ifdef OX_CUSTOMIZE_COMMANDS    
    VERIFY(m_customizeManager.InitializeCommands());    
#endif   //OX_CUSTOMIZE_COMMANDS

The Faq\CustMngrSdi project demonstrates this.

Including additional RC files. (05/07/2002)

Q. How can I include the resources (*.rc file) if I have one included already?

A: For VC6, to include a resource file, for example, utsampleabout.rc , go to View->Resource Includes.. and enter it in the dialog box as shown:

Screenshot - resinclude.jpg

For VS2005, you can right click on an existing .rc file in the resource view and select Resource Includes...

COX3DTabViewContainer in MDI app. (06/20/2000)

Q. How can I create COX3DTabViewContainer like a page of another COXTabViewContainer in an MDI application?

A: We've wrapped up a sample of how to do this in the Faq\3DTabIn3DTab dir of the faq samples download.

Screenshot - 3DTabIn3DTab.jpg
The 3DTabIn3DTab sample in action.

COX3DTabViewContainer in splitter pane. (06/12/2000)

Q. How can I create COX3DTabViewContainer or COXTabViewContainer in a pane with splitter?

A: You have to derive your own class from COX3DTabViewContainer and provide dynamic creation capabilities (using macro IMPLEMENT_DYNCREATE and DECLARE_DYNCREATE). COXTabViewContainer does not require you to override it, but you may want to do it. Then, create the panes in the usual way.

See also the Faq\TabsInPane\TabProblem sample to see how this is done.

Screenshot - TabsInSplit.jpg
Two types of tabbed views can be used in a split window.

COXTreeCtrl in splitter pane. (06/02/2000)

Q. How can I create COXTreeCtrl in a pane of the view with a splitter?

A: The idea is to create the pane with the view as usual and make COXTreeCtrlmember of this view. Once the view has been created � create COXTreeCtrlobject. In addition we need to handle WM_SIZE message to change the size of the tree.

See the sample project in the Faq\TreeInPane dir for more details.

RichEdit control in COXTabViewContainer. (06/02/2000)

Q. How can I create RichEdit control pages in COXTabViewContainer?

A: We've included a sample that shows how this can be done. Don't forget to call AfxInitRichEdit() before starting to work with rich edit control.

The sample project in the Faq\RichInTab dir shows this in action.

Using COXToolTipCtrl in a view. (06/02/2000)

Q. How can I attach your COXToolTipCtrl to a view. I have created an MFC CToolTipCtrl and it worked. After replacing CToolTipCtrl with COXToolTipCtrl it did not work. How should I use COXToolTipCtrl?

A: COXTolTipCtrl needs to be attached to the main application window. You have to provide a handler for RelayEvent() in the PreTranslateMessage() virtual function of your main class. The tool may be a window or rectangle of a window.

See the sample in the Faq\ToolTipInView directory for a working implementation.

History

Initial CodeProject release October 2007.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here