![]() |
Toolbar control problem !!! |
Post Reply ![]() |
Author | |
scs7309 ![]() Newbie ![]() ![]() Joined: 05 January 2007 Location: Korea, South Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() Posted: 09 January 2007 at 2:39am |
![]() ![]() 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; } |
|
![]() |
|
scs7309 ![]() Newbie ![]() ![]() Joined: 05 January 2007 Location: Korea, South Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
They are not activated because you didn't add handlers for them. Copy code from GUI_OneNoteView.cpp
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |