Print Page | Close Window

Gallery control right click

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=6994
Printed Date: 19 July 2025 at 9:44am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Gallery control right click
Posted By: BastianPL
Subject: Gallery control right click
Date Posted: 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



Replies:
Posted By: Oleg
Date Posted: 27 April 2007 at 1:14am
Hi,
 
Override CXTPControlGallery, and its OnRButtonDown method.


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


Posted By: BastianPL
Date Posted: 27 April 2007 at 5:25am
Can You show me some example ???
 
Thanks


-------------
Bastian


Posted By: BastianPL
Date 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


Posted By: Oleg
Date 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


Posted By: BastianPL
Date Posted: 27 April 2007 at 7:23am
Originally posted by oleg oleg wrote:

Hi,
 
something like:
 
class CMyControlGallery : public CXTPControlGallery
{
 DECLARE_XTP_CONTROL(CMyControlGallery )
protected:
 virtual BOOL OnRButtonDown(CPoint point);
}
 
etc.
 
thanks


-------------
Bastian


Posted By: BastianPL
Date 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


Posted By: BastianPL
Date Posted: 04 May 2007 at 10:53am
Maybe I should override also OnRButtonDown method for RibbonBar ?
 
Thanks for any advices
 


-------------
Bastian


Posted By: BastianPL
Date 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


Posted By: BastianPL
Date 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


Posted By: Oleg
Date 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


Posted By: BastianPL
Date 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



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