![]() |
Gallery control right click |
Post Reply
|
| Author | |
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Topic: Gallery control right clickPosted: 26 April 2007 at 12:52pm |
|
Is it possible to override right click message on gallery control. I would like to add small popup menu to gallery ?? Thanks |
|
|
Bastian
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 1:14am |
|
Hi,
Override CXTPControlGallery, and its OnRButtonDown method.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 5:25am |
|
Can You show me some example ???
Thanks
|
|
|
Bastian
|
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 6:15am |
|
I am trying this code in my CMainFrame but it doesn't work:
In CMainFrame.h i declared
afx_msg void OnRButtonDown( UINT nFlags, CPoint pt );
In CMainFrame.cpp ON_WM_RBUTTONDOWN() and function body:void CMainFrame::OnRButtonDown( UINT nFlags, CPoint pt ){ AfxMessageBox( "RBUTTONDOWN()" );} |
|
|
Bastian
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 6:58am |
|
Hi,
something like:
class CMyControlGallery : public CXTPControlGallery
{ DECLARE_XTP_CONTROL(CMyControlGallery ) protected: virtual BOOL OnRButtonDown(CPoint point); }
etc.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 7:23am |
thanks
|
|
|
Bastian
|
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 May 2007 at 10:15am |
|
This is virtual function so i don't need a message maps. My header is like you show and my cpp file is like below:
IMPLEMENT_XTP_CONTROL ( CTestControlGallery, CXTPControlGallery )/*************************************************************************************************************************************************************\ * * CTestControlGallery() * * DESCRIPTION: * Constructor * \*************************************************************************************************************************************************************/ CTestControlGallery ::CTestControlGallery(void){ } /*************************************************************************************************************************************************************\ * * ~CTestControlGallery() * * DESCRIPTION: * Destructor * \*************************************************************************************************************************************************************/ CTestControlGallery ::~CTestControlGallery(void){ } /*************************************************************************************************************************************************************\ * * BOOL OnRButtonDown( CPoint point ) * * DESCRIPTION: * On Right Button down message handler * \*************************************************************************************************************************************************************/ BOOL CTestControlGallery::OnRButtonDown( CPoint point ){ AfxMessageBox( "TEST" ); return FALSE;}
but id doesn't work. Insetad message "Test " appears menu to cuatomize ribbon bar. |
|
|
Bastian
|
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 May 2007 at 10:53am |
|
Maybe I should override also OnRButtonDown method for RibbonBar ?
Thanks for any advices
|
|
|
Bastian
|
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 May 2007 at 12:45pm |
|
Oleg, I tried do it via your method but it wouldn't work. Maybe I am doing something wrong. Instead of this i add following code do CMainFrame class:
LRESULT CMainFrame::OnControlRButtonUp( WPARAM wParam, LPARAM lParam ){CXTPControl *pControl = (CXTPControl *)lParam; if ( pControl->GetID() == ID_GALLERY_FORMAT ) { CMenu menu;
menu.LoadMenu( IDR_MAINFRAME ); CPoint pt; GetCursorPos( &pt ); UINT nReturn = CXTPCommandBars::TrackPopupMenu( menu.GetSubMenu(0), TPM_NONOTIFY | TPM_RECURSE | TPM_RETURNCMD, pt.x, pt.y, this ); /*switch (nReturn) { .... }*/ return TRUE; } return FALSE; } And It is working - almost good because I still "under" my popup menu have a standard ribbon customization menu. How can I turn it off ???
Thanks for Your patients ;) |
|
|
Bastian
|
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 May 2007 at 9:23pm |
|
Why i can override only WM_XTP_CONTROLRBUTTONUP and I can not find WM_XTP_CONTROLRBUTTONDOWN method ???
Thanks for any ideas.
|
|
|
Bastian
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2007 at 7:56am |
|
Hm, Actually you right, CXTPRibbonbar don't call OnRButtonDown for focused control :(
Sorry, please patch sources - in CXTPRibbonBar::OnRButtonDown add
if (pControl && pControl->OnRButtonDown(point))
return; now you will be able to override OnRButtonDown.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 May 2007 at 10:22am |
|
Unfortunettly i cant do that because I want to show the context menu in some cases. and if i put this line i will never show the context menu.
Regards
|
|
|
Bastian
|
|
![]() |
|
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 |