Print Page | Close Window

Mouse handlers

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13028
Printed Date: 01 May 2025 at 6:39am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Mouse handlers
Posted By: gmail
Subject: Mouse handlers
Date Posted: 29 December 2008 at 8:47am
I've subclassed your CXTPToolBar class and I'm trying to override mouse events like ON_WM_LBUTTONDOWN messages but my functions never gets called? I've checked all of your samples but none of them shows something like this (and I haven't found anything on your forum regarding this). Can you explain how can one achieve catching mouse click events (left/right/drag/drop) on CXTPToolBar class?



Replies:
Posted By: Oleg
Date Posted: 30 December 2008 at 12:57am
Show all code you tried.

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


Posted By: gmail
Date Posted: 30 December 2008 at 12:27pm
In my MyToolBar.h file:

class CMojToolBar : public CXTPToolBar
{
    DECLARE_DYNAMIC(CMyToolBar)

public:
    CMyToolBar();
    virtual ~CMyToolBar();
protected:
    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
};

In my MyToolBar.cpp file:

IMPLEMENT_DYNAMIC(CMyToolBar, CXTPToolBar)

CMyToolBar::CMyToolBar()
{
}

CMyToolBar::~CMyToolBar()
{
}

BEGIN_MESSAGE_MAP(CMyToolBar, CXTPToolBar)
    ON_WM_LBUTTONDOWN()
    ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()

void CMyToolBar::OnLButtonDown(UINT nFlags, CPoint point)
{
    AfxMessageBox(_T("click"));
    CXTPToolBar::OnLButtonDown(nFlags, point);
}

void CMyToolBar::OnMouseMove(UINT nFlags, CPoint point)
{
    AfxMessageBox(_T("move"));
    CXTPToolBar::OnMouseMove(nFlags, point);
}


In my MainFrm.cpp file:

CMojToolBar* ptol=(CMojToolBar*)pCommandBars->Add(_T("ptol"),xtpBarFloating);
    ptol->LoadToolBar(IDR_TOOLBAR);
    ptol->SetBarID(55);


Posted By: gmail
Date Posted: 07 January 2009 at 2:10pm
Any update on those mouse overloaded functions?


Posted By: SuperMario
Date Posted: 29 April 2010 at 3:03pm
Think you are missing:

DECLARE_XTP_COMMANDBAR(CMojToolBar)
IMPLEMENT_XTP_COMMANDBAR(CMojToolBar, CXTPToolBar);



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