Hi Support,
Today we can implement, a CExtToolBoxWnd class and add items into it. the items are duely highlighted when we move the mouse over it.
I did it on the lines of FormEditor, using the following:
m_wndBinsBar.ModifyToolBoxWndStyle(__TBWS_PM_BUTTONS);
How is it possible to create a view over a CExtToolBoxWnd? My current bins bar is a CExtControlBar, where i safely have Cviews over it.
But how can i make that work for CExtToolBoxWnd? If I try so, no view is being shown at all for the bins.
The following is the way how I create my controls on the view. One of these is a treectrl(CsaBinsTools). Now I want to change it to a tree where i can see the treeitems highlighted once i hover the mouse on it.
int
CSaBinsCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// Let the base class do it’s thing.
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// Create the all of the controls.
SA_CATCH_ALL_BEGIN
{
// All of the controls will be resized during the WM_SIZE message.
CRect rect(0, 0, 1, 1);
// Licensing for SAIC.OCX.
WCHAR szLicString[] = L"707A747B626CGNUD777E102060";
BSTR bstrLic = ::SysAllocString(szLicString);
// Create the Bins themselves. Note that the "caption" text passed in
// to each them will never actually be displayed to the user, so there is
// no need to translate it.
//UI Enhancements 6.5
CCreateContext* pContext = NULL;
if (lpCreateStruct != NULL)
pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;
if(!m_binTabPage.Create (this,rect,IDS_SABINS_TAB_PAGE,WS_CHILD|WS_VISIBLE ))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_PARTS);
}
//UI Enhancements 6.5
if (!m_binParts.Create("Repository Tree Control", 0,
rect, this, IDC_SABINS_BIN_PARTS,
NULL, FALSE, bstrLic))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_PARTS);
}
if (!m_binPlanFolders.Create(NULL, "Repository Tree Control", WS_CHILD,
rect, this, IDC_SABINS_BIN_RECYCLE))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_PLANS);
}
if (!m_binPlanFolderRecycler.Create(NULL, "Repository Tree Control", WS_CHILD,
rect, this, IDC_SABINS_BIN_PLANS))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_RECYCLE);
}
if (!m_binTools.Create("Repository Tree Control", 0,
rect, this, IDC_SABINS_BIN_TOOLS,
NULL, FALSE, bstrLic))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_TOOLS);
}
// Create the Search Engine control. Note that the "caption" text
// passed in to it will never actually be displayed to the user, so
// there is no need to translate it.
if (!m_SearchEngine.Create("Search Engine Control", WS_VISIBLE,
rect, this, IDC_SABINS_SEARCH_ENGINE,
NULL, FALSE, bstrLic))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_CREATE_SEARCH_ENGINE);
}
// End of need for licensing information.
::SysFreeString(bstrLic);
bstrLic = NULL;
// Create the bin-switching controls. Note that the "caption" text
// passed in to each them will never actually be displayed to the user,
// so there is no need to translate it.
//UI Enhancements 6.5
if(!m_binTabPage.ItemInsert ("Parts",0,TRUE,__ETWI_GROUP_START,-1,0,FALSE))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_PARTS);
}
//UI Enhancements 6.5
if (!m_abtnParts.Create("Parts", BS_PUSHBUTTON | BS_OWNERDRAW,
rect, /*&m_binTabPage*/this, IDC_SABINS_BSW_PARTS))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_CREATE_BSW_PARTS);
}
//UI Enhancements 6.5
if(!m_binTabPage.ItemInsert ("Plans",0,TRUE,__ETWI_DISABLED,-1,0,FALSE))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_PLANS);
}
//UI Enhancements 6.5
if (!m_abtnPlans.Create("Plans", BS_PUSHBUTTON | BS_OWNERDRAW,
rect, /*&m_binTabPage*/this, IDC_SABINS_BSW_PLANS))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_CREATE_BSW_PLANS);
}
//UI Enhancements 6.5
if(!m_binTabPage.ItemInsert ("Recycle",0,TRUE,__ETWI_DISABLED,-1,0,FALSE))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_RECYCLE);
}
//UI Enhancements 6.5
if (!m_abtnRecycle.Create("Recycle", BS_PUSHBUTTON | BS_OWNERDRAW,
rect,/*&m_binTabPage*/ this, IDC_SABINS_BSW_RECYCLE))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_CREATE_BSW_RECYCLE);
}
//UI Enhancements 6.5
if(!m_binTabPage.ItemInsert ("Tools",0,TRUE,__ETWI_DISABLED,-1,0,FALSE))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_BIN_CREATE_TOOLS);
}
//UI Enhancements 6.5
if (!m_abtnTools.Create("Tools", BS_PUSHBUTTON | BS_OWNERDRAW,
rect, /*&m_binTabPage*/this, IDC_SABINS_BSW_TOOLS))
{
throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_CREATE_BSW_TOOLS);
}
// Create the bin-switcher tool-tip control.
m_ttipSwitchers.Create(this);
// Set up each bin-switcher’s bitmaps
m_abtnParts.SetBitmaps(IDB_SABINS_BSW_PARTS_ACTIVE,
IDB_SABINS_BSW_PARTS_INACTIVE,
IDB_SABINS_BSW_PARTS_DOWN,
IDB_SABINS_BSW_PARTS_CHECKED);
m_abtnPlans.SetBitmaps(IDB_SABINS_BSW_PLANS_ACTIVE,
IDB_SABINS_BSW_PLANS_INACTIVE,
IDB_SABINS_BSW_PLANS_DOWN,
IDB_SABINS_BSW_PLANS_CHECKED);
m_abtnTools.SetBitmaps(IDB_SABINS_BSW_TOOLS_ACTIVE,
IDB_SABINS_BSW_TOOLS_INACTIVE,
IDB_SABINS_BSW_TOOLS_DOWN,
IDB_SABINS_BSW_TOOLS_CHECKED);
m_abtnRecycle.SetBitmaps(IDB_SABINS_BSW_RECYCLE_ACTIVE,
IDB_SABINS_BSW_RECYCLE_INACTIVE,
IDB_SABINS_BSW_RECYCLE_DOWN,
IDB_SABINS_BSW_RECYCLE_CHECKED);
// Set up each bin-switcher’s colors. This control what
// system colors get substituted for colors in the above-set bitmaps.
// Bitmaps contain purple for button face.
m_abtnParts.MapColor( RGB(0xFF,0x00,0xFF), COLOR_BTNFACE );
m_abtnPlans.MapColor( RGB(0xFF,0x00,0xFF), COLOR_BTNFACE );
m_abtnTools.MapColor( RGB(0xFF,0x00,0xFF), COLOR_BTNFACE );
m_abtnRecycle.MapColor( RGB(0xFF,0x00,0xFF), COLOR_BTNFACE );
// Bitmaps contain dark magenta for button hightlight.
m_abtnParts.MapColor( RGB(0x80,0x00,0x80), COLOR_BTNHIGHLIGHT );
m_abtnPlans.MapColor( RGB(0x80,0x00,0x80), COLOR_BTNHIGHLIGHT );
m_abtnTools.MapColor( RGB(0x80,0x00,0x80), COLOR_BTNHIGHLIGHT );
m_abtnRecycle.MapColor( RGB(0x80,0x00,0x80), COLOR_BTNHIGHLIGHT );
// Bitmaps contain dark cyan for button shadow.
m_abtnParts.MapColor( RGB(0x00,0x80,0x80), COLOR_BTNSHADOW );
m_abtnPlans.MapColor( RGB(0x00,0x80,0x80), COLOR_BTNSHADOW );
m_abtnTools.MapColor( RGB(0x00,0x80,0x80), COLOR_BTNSHADOW );
m_abtnRecycle.MapColor( RGB(0x00,0x80,0x80), COLOR_BTNSHADOW );
// Add each bin-switcher to the tool-tip control.
m_abtnParts.SetToolTip(m_ttipSwitchers, IDS_SABINS_BSWTIP_PARTS);
m_abtnPlans.SetToolTip(m_ttipSwitchers, IDS_SABINS_BSWTIP_PLANS);
m_abtnTools.SetToolTip(m_ttipSwitchers, IDS_SABINS_BSWTIP_TOOLS);
m_abtnRecycle.SetToolTip(m_ttipSwitchers, IDS_SABINS_BSWTIP_RECYCLE);
// Set up the drop targets for each bin-switcher.
m_swtargParts.m_lBinType = SABINS_BINTYPE_PARTS;
m_swtargParts.Register(&m_abtnParts);
m_swtargPlans.m_lBinType = SABINS_BINTYPE_PLANS;
m_swtargPlans.Register(&m_abtnPlans);
m_swtargRecycle.m_lBinType = SABINS_BINTYPE_RECYCLED;
m_swtargRecycle.Register(&m_abtnRecycle);
m_swtargTools.m_lBinType = SABINS_BINTYPE_TOOLS;
m_swtargTools.Register(&m_abtnTools);
// Save the optimum switcher size, according to the size of the bitmaps.
m_abtnParts.SizeToContent();
m_abtnParts.GetWindowRect(rect);
m_iSwitcherHeight = rect.Height();
m_iSwitcherWidth = rect.Width();
// Allow a small gap above and below the switchers. We can’t just increase
// the height of the buttons, because CBitmapButton doesn’t do vertical
// centering.
m_iSwitcherVerticalGap = 3;
// Make the bins globally available.
CSaBinsGlobals::Instance()->SetBins(&m_binParts, &m_binPlanFolderRecycler, &m_binTools, &m_binPlanFolders);
// Disable each bin until the app is done loading.
EnableAllBins(FALSE);
// Associate the parts bin with the search engine.
m_binParts.SetSearchEngine(&m_SearchEngine);
// This is required to make F1 help processing work. Without this,
// m_pMainWnd remains null, causing help commands to go to the currently
// active window instead of this window. We want them to go to this
// window (the control window) so that the default help processing will
// occur (ID_HELP processing, etc.).
AfxGetApp()->m_pMainWnd = this;
}
SA_CATCH_ALL_END
(
// The MFC caller tries to go on if exception, so we must display the
// error and return -1.
CSa_Exception * pE = new CSa_Exception(SABINS_CAT_INTERNAL_ERROR,
SABINS_E_CREATE_CONTROL);
SaUtDisplayExceptionDlg(NULL, pE);
pE->Delete();
return -1;
)
return 0;
}