Print Page | Close Window

CXTPToolBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5163
Printed Date: 11 November 2025 at 5:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPToolBar
Posted By: Sergio
Subject: CXTPToolBar
Date Posted: 28 September 2006 at 5:59am

Hi everybody,

How could I know the CXTPControl* pointer from within a notification command ?
 
I need this functionality for a dynamic contextual menu in the ToolBar, that route to one function giving the menu item user data.
 
My mainframe is doesn't use Codejock, I have used the ToolBar CXTPToolBar in a standard CView :
 
 
MyView.h
CXTPToolBar m_XTPToolBar;
 
afx_msg void OnButtonTest();
 
MyView.cpp
CMyView::OnInitialUpdate()

VERIFY( m_XTPToolBar.CreateToolBar( WS_VISIBLE | WS_CHILD | CBRS_TOOLTIPS, this ) );

CXTPControl* pControl;

CXTPControls* pControls = m_XTPToolBar.GetControls();
pControl = pControls->Add( ...data of button test... );
if ( pControl )
{
DWORD dwItemData = 67; // Internal identifier
pControl->SetTag( dwItemData );
}
 
 
CMyView::OnButtonTest()
 
CXTPControl* pControl = m_XTPToolBar.GetCurrentActionControl();
if ( pControl )
{
DWORD dwItemData = pControl->GetTag();
... do something with dwItemData ...
}
 
Could you please help me as soon as possible  ? This is the last thing to complete my project. I need the feature in red.
 
Thank you in advance !
 


-------------
Sergio



Replies:
Posted By: Oleg
Date Posted: 28 September 2006 at 8:54am
Hi,
 
You can catch WM_XTP_COMMAND instead to get pointer of control. WM_COMMAND have no  additional parameters.


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


Posted By: Sergio
Date Posted: 28 September 2006 at 9:30am
Hi Oleg,
 
Thank you for your prompt answer, the WM_XTP_COMMAND doesn't reach the WindowProc(...) of my CView class.
 
Here is the main reason : the WM_XTP_COMMAND notification message is sent only if the m_pOwner member variable of the CXTPToolBar (in fact of the CXTPCommandBar) is set to the CWnd* (a pointer to my CView).
 
There is a method called GetOwnerSite() that return this pointer, but there is no method called SetOwnerSite(CWnd*), and the m_pOwner member variable is declared as protected.
 
Perhaps I should create my own ToolBar class derived from your CXTPToolBar and add this method, is it safe ?
 
Sergio
 


-------------
Sergio



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