Intercepting the mouse click |
Post Reply |
Author | |
afekhar
Groupie Joined: 30 August 2006 Location: France Status: Offline Points: 43 |
Post Options
Thanks(0)
Posted: 28 September 2006 at 5:19am |
Thanks alot for all your advices. I want to intercept the click on a panel group (not item) and the click events sent by the control are for panel items only. I'll try to create a wrapper class as you suggested.
|
|
jfstephe
Newbie Joined: 07 July 2006 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
You can also subscribe to the event that are raised. E.g.
in .h
afx_msg void OnItemClickTaskpanel1(LPDISPATCH Item);
afx_msg void OnGroupExpandedTaskpanel1(LPDISPATCH Group);
in .cpp
BEGIN_EVENTSINK_MAP(CCodejockDlg, CDialog) //{{AFX_EVENTSINK_MAP(CCodejockDlg) ON_EVENT(CCodejockDlg, IDC_TASKPANEL1, 1 /* ItemClick */, OnItemClickTaskpanel1, VTS_DISPATCH) ON_EVENT(CCodejockDlg, IDC_TASKPANEL1, 6 /* GroupExpanded */, OnGroupExpandedTaskpanel1, VTS_DISPATCH) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() void CCodejockDlg::OnItemClickTaskpanel1(LPDISPATCH Item)
{ // handler }
You could do this by hand but again it's easily done tthrough the class wizard.
|
|
jfstephe
Newbie Joined: 07 July 2006 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Hmm. That's a bit wierd.
and make sure the activeX object is registered. Perhaps this is license file related (again see the link).
Are you using VS6 or 7?
I take it you inserted the activex control by right clicking on the dialog selecting 'Insert ActiveX Control...' and selecting the control from the dialog?
If you did all that then I think something is knackered. Sorry. I would suggest sorting out your activex instantiated object problem before continuing.
J
|
|
afekhar
Groupie Joined: 30 August 2006 Location: France Status: Offline Points: 43 |
Post Options
Thanks(0)
|
Just one tip and it will be ok, I tried to put the taskpanel activex on a dialog (in the resource view) in order to use the classwizard and create a wrapper class, but the problem is that VStudio refuse that by displaying a message "This activex can't be instantiated". Is there another means to create a wrapper class ?
Thank you very much for your help. |
|
jfstephe
Newbie Joined: 07 July 2006 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Yeah, it shouldn't be a problem, that's what I'm using.
The easiest way to do it is:
Associate a member variable to your activeX object via ClassWizard. It'll say that it need to generate the TaskPanel wrapper classes for you - change the name/location of these as you see fit.
You now have a member variable to play with and it's of type CTaskPanel.
Add a new generic MFC class derived from CWnd (CMyTaskPanel). ('Insert' -> 'New Class')
Change the base class of CMyTaskPanel from CWnd to CTaskPanel.
The job should indeed now be a good one :-).
Right click on your class in 'ClassView' and add a windows message handler for the message you want.
Like I said, if this doesn't seem to catch the message you can override PreTranslateMessage in CMyTaskPanel e.g.
BOOL CMyTaskPanel ::PreTranslateMessage( MSG* pMsg ) { if (pMsg->message == WM_KEYDOWN) { // I've caught a key press } return CTaskPanel::PreTranslateMessage(pMsg);
} |
|
afekhar
Groupie Joined: 30 August 2006 Location: France Status: Offline Points: 43 |
Post Options
Thanks(0)
|
Thanks alot, but I use the ActiveX version. Don't you know if i can wrap the activex with a window class or something ?
|
|
jfstephe
Newbie Joined: 07 July 2006 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
This will work for VC++: If you derive a class from CTaskPanel you can capture the messages it sees. Try to react to the click event by implementing the appropriate message handler, if that doesn't work, override PreTranslateMessage and get the click event that way.
|
|
afekhar
Groupie Joined: 30 August 2006 Location: France Status: Offline Points: 43 |
Post Options
Thanks(0)
|
How can I intercept the left mouse click on a TaskPanelGroup header?
Any tip will be greatly appreciated, Thanks. |
|
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 |