![]() |
OnCreateControl w/ CXTPToolbar base |
Post Reply ![]() |
Author | |
craig ![]() Groupie ![]() Joined: 11 August 2005 Location: United States Status: Offline Points: 44 |
![]() ![]() ![]() ![]() ![]() Posted: 27 October 2005 at 4:02pm |
I have a class CFormatToolBar that derives from CXTPToolBar. I'm trying to keep the creation of the controls in that toolbar contained within that class. Is it possible to map the ON_XTP_CREATECONTROL() message in my derived class? Right now, the OnCreateControl method isn't getting called, although the toolbar is loading ok. E.g Will the following work in a CXTPToolBar derived class? BEGIN_MESSAGE_MAP(CFormatToolBar, CXTPToolBar)ON_XTP_CREATECONTROL() Thanks, Craig
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
WM_XTP_CREATECONTROL sends only to parent CommandBars object (Frame). You can catch it on frame and deliver to Toolbar object.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
craig ![]() Groupie ![]() Joined: 11 August 2005 Location: United States Status: Offline Points: 44 |
![]() ![]() ![]() ![]() ![]() |
ok. That's what I'm doing currently. --Craig
|
|
![]() |
|
craig ![]() Groupie ![]() Joined: 11 August 2005 Location: United States Status: Offline Points: 44 |
![]() ![]() ![]() ![]() ![]() |
2005-10-28_161431_FormatToolBar.zipWell... it doesn't work.
This message appears in xtpcontrolcombobox.h in the following snippet: AFX_INLINE int CXTPControlComboBox::AddString(CString str) { return GetListBoxCtrl()->AddString(str);}
I've attached the CFormatBar class files. In CMainFrame I did the following to pass the messages on: BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)ON_XTP_CREATECONTROL() END_MESSAGE_MAP() int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl){ CXTPCommandBars* pCommandBars = GetCommandBars(); if (pCommandBars != NULL) { CXTPToolBar* pToolbar = pCommandBars->GetToolBar(IDR_FORMAT_TOOLBAR); if (pToolbar) { CFormatToolBar* pFmtBar = (CFormatToolBar*) pToolbar; return pFmtBar->OnCreateControl(lpCreateControl); } } return FALSE; } |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Don't use member variables XTPControlComboBox m_fontSizeCombo; create it dynamically: CXTPControlComboBox* fontSizeCombo = new CXTPControlComboBox();
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
craig ![]() Groupie ![]() Joined: 11 August 2005 Location: United States Status: Offline Points: 44 |
![]() ![]() ![]() ![]() ![]() |
Oleg, OK... that sounds reasonable, but how can I get a hold of the control by ID? E.g. by ID. I see how to get a toolbar by ID, I can get a list of controls, but haven't been able to figure out how to get a control by its ID. I need to modify this control in response to an event generated by a different control. Thanks, Craig
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, CXTPControl* pControl = pToolBar->GetControls()->FindControl(id); but! don't forget that user can customize this toolbar and move button away. |
|
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 |