Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - OnCreateControl w/ CXTPToolbar base
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

OnCreateControl w/ CXTPToolbar base

 Post Reply Post Reply
Author
Message
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Topic: OnCreateControl w/ CXTPToolbar base
    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()
END_MESSAGE_MAP()

Thanks,

Craig

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2005 at 3:57am

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
Back to Top
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2005 at 1:59pm

ok.  That's what I'm doing currently.

--Craig

 

Back to Top
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2005 at 4:16pm

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;

}

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2005 at 1:40am

Don't use member variables

XTPControlComboBox m_fontSizeCombo;

create it dynamically:

CXTPControlComboBox* fontSizeCombo = new CXTPControlComboBox();

 

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2005 at 3:03pm

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

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 12:09am

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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.