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

Gallery control right click

 Post Reply Post Reply
Author
Message
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post Topic: Gallery control right click
    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
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: 27 April 2007 at 1:14am
Hi,
 
Override CXTPControlGallery, and its OnRButtonDown method.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post Posted: 27 April 2007 at 5:25am
Can You show me some example ???
 
Thanks
Bastian
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post 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
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: 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
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 2007 at 10:53am
Maybe I should override also OnRButtonDown method for RibbonBar ?
 
Thanks for any advices
 
Bastian
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post 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
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: 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
Back to Top
BastianPL View Drop Down
Groupie
Groupie
Avatar

Joined: 15 April 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote BastianPL Quote  Post ReplyReply Direct Link To This Post 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
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.063 seconds.