Print Page | Close Window

Toolbar control problem !!!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=6041
Printed Date: 03 July 2024 at 3:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Toolbar control problem !!!
Posted By: scs7309
Subject: Toolbar control problem !!!
Date Posted: 09 January 2007 at 2:39am
My propose is GUI_OneNote Toolbar looks like below.
 
 
 
Below is my test program screenshot.
This program toolbar has CXTPControlFontComboBox, CXTPControlSizeComboBox and two CXTPControlPopupColor controls. 
 
 
But inserted controls(CXTPControlFontComboBox, CXTPControlSizeComboBox and two CXTPControlPopupColor controls)
never activated !!!!!
what's wrong??? what's problem???
Please help me !!!!!
 
 
 
Here is my code.
 
MainFrm.h
 
class CMainFrame : public CXTPMDIFrameWnd, CXTPOffice2007FrameHook
{
 DECLARE_DYNAMIC(CMainFrame)
public:
 CMainFrame();
// Attributes
public:
// Operations
public:
// Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CMainFrame)
 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
 //}}AFX_VIRTUAL
// Implementation
public:
 virtual ~CMainFrame();
#ifdef _DEBUG
 virtual void AssertValid() const;
 virtual void Dump(CDumpContext& dc) const;
#endif
protected:  // control bar embedded members
 CXTPStatusBar m_wndStatusBar;
// Generated message map functions
protected:
 //{{AFX_MSG(CMainFrame)
 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 afx_msg int OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl);
 //}}AFX_MSG
 
 DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__F4F24561_D850_4A9C_A3A1_D3EB1CD55BD4__INCLUDED_)
 
 
 
MainFrm.cpp
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  return -1;
 if (!m_wndStatusBar.Create(this) ||
  !m_wndStatusBar.SetIndicators(indicators,
  sizeof(indicators)/sizeof(UINT)))
 {
  TRACE0("Failed to create status bar\n");
  return -1;      // fail to create
 }
 // Initialize command bars.  Command bars must be created and initialized
 // after all standard MFC control bars have been created.
 if (!InitCommandBars())
  return -1;
 CXTPPaintManager::SetTheme(xtpThemeOffice2007);
 // Get a pointer to the command bars object.
 CXTPCommandBars *pCommandBars = GetCommandBars();
 // create the menubar.
 CXTPCommandBar *pMenuBar = pCommandBars->SetMenu(_T("Menu"), IDR_MAINFRAME);
 pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);
 // create the general toolbar.
 CXTPToolBar *pGeneralToolbar = (CXTPToolBar *)pCommandBars->Add(_T("General"), xtpBarTop);
 if(!pGeneralToolbar || !pGeneralToolbar->LoadToolBar(IDR_MAINFRAME))
 {
  TRACE0("Failed to create toolbar\n");
  return -1;
 }
 return 0;
}
 
int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
 if (lpCreateControl->bToolBar == FALSE)
  return FALSE;
 else
 {
  CXTPToolBar* pToolBar = DYNAMIC_DOWNCAST(CXTPToolBar, lpCreateControl->pCommandBar);
  if (!pToolBar)
   return FALSE;

  if (lpCreateControl->nID == ID_COMBO_FONTNAME && pToolBar->GetBarID() == IDR_MAINFRAME)
  {
   CXTPControlComboBox* pComboFont = new CXTPControlFontComboBox();
   pComboFont->SetDropDownListStyle(FALSE);
   
   lpCreateControl->pControl = pComboFont;
   return TRUE;
  }
  if (lpCreateControl->nID == ID_COMBO_FONTSIZE && pToolBar->GetBarID() == IDR_MAINFRAME)
  {
   CXTPControlComboBox* pComboSize = new CXTPControlSizeComboBox();
   pComboSize->SetDropDownListStyle();
   
   lpCreateControl->pControl = pComboSize;
   return TRUE;
  }
  if (lpCreateControl->nID == ID_COMBO_FONTCOLOR && pToolBar->GetBarID() == IDR_MAINFRAME)
  {
   CXTPControlPopupColor* pPopupColorText = new CXTPControlPopupColor();
   CXTPPopupBar* pColorBar = (CXTPPopupBar*)CXTPPopupToolBar::CreateObject();
   pColorBar->GetControls()->Add(new CXTPControlButtonColor(), ID_TEXT_AUTO);
   pColorBar->GetControls()->Add(new CXTPControlColorSelector(), ID_SELECTOR_TEXT);
   pColorBar->GetControls()->Add(new CXTPControlButtonColor(), ID_TEXT_MORE);
   pPopupColorText->SetCommandBar(pColorBar);
   pColorBar->InternalRelease();
   pColorBar->SetTearOffPopup(_T("Text Color"), IDR_COLORTEXT_POPUP, 0);
   pColorBar->EnableCustomization(FALSE);
   lpCreateControl->pControl = pPopupColorText;
   return TRUE;
  }
  if (lpCreateControl->nID == ID_COMBO_BGCOLOR && pToolBar->GetBarID() == IDR_MAINFRAME)
  {
   CXTPControlPopupColor* pPopupColorBack = new CXTPControlPopupColor();
   CXTPPopupBar* pColorBar = (CXTPPopupBar*)CXTPPopupToolBar::CreateObject();
   pColorBar->GetControls()->Add(new CXTPControlButtonColor(), ID_BACK_NONE);
   pColorBar->GetControls()->Add(new CXTPControlColorSelector(), ID_SELECTOR_BACK);
   pColorBar->GetControls()->Add(new CXTPControlButtonColor(), ID_BACK_MORE);
   pPopupColorBack->SetCommandBar(pColorBar);
   pColorBar->InternalRelease();
   pColorBar->SetTearOffPopup(_T("Back Color"), IDR_COLORBACK_POPUP, 0);
   pColorBar->EnableCustomization(FALSE);
   lpCreateControl->pControl = pPopupColorBack;
   return TRUE;
  }
 }
 
 return FALSE;
}



Replies:
Posted By: scs7309
Date Posted: 09 January 2007 at 2:45am

My program source is here.

Please help me !!!
 
 
https://forum.codejock.com/uploads/20070109_024441_MyTheme.zip - uploads/20070109_024441_MyTheme.zip


Posted By: Oleg
Date Posted: 09 January 2007 at 3:08am

They are not activated because you didn't add handlers for them.

 
Copy code from GUI_OneNoteView.cpp  
 
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net