Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPToolBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPToolBar

 Post Reply Post Reply
Author
Message
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post Topic: CXTPToolBar
    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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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 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
Back to Top
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post 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
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.033 seconds.