Visit the Ultimate Toolbox main page for an overview and configuration guide to the Ultimate Toolbox library.
Contents
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.
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.
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.
The 3DDlgTab sample in action.
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)
{
int nWidth=80;
nIndex=m_wndToolBar.AddCustomButton(&m_editCB, IDC_CBEDIT, nWidth);
if(nIndex==-1)
return -1;
nPosition=2;
VERIFY(m_wndToolBar.InsertEditBox(nPosition, nIndex));
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.
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:
- Create template for the dialog bar in the resource editor.
- On this dialog bar place the common controls you want.
- Go to Class Wizard and derive your own class from
CDialogBar
.
- 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;
....
}
- 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);
}
- 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;
UpdateData(FALSE);
return TRUE;
}
- 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.
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.
The SplitInTab sample showing a splitter in one tab.
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.
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);
}
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
#ifdef OX_CUSTOMIZE_COMMANDS
VERIFY(m_customizeManager.InitializeCommands());
#endif
The Faq\CustMngrSdi project demonstrates this.
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:
For VS2005, you can right click on an existing .rc file in the resource view and select Resource Includes...
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.
The 3DTabIn3DTab sample in action.
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.
Two types of tabbed views can be used in a split window.
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 COXTreeCtrl
member of this view. Once the view has been created � create COXTreeCtrl
object. 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.
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.
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.
Initial CodeProject release October 2007.