Print Page | Close Window

How to diaplay a popup menu?

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=1464
Printed Date: 06 October 2024 at 4:18am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to diaplay a popup menu?
Posted By: freehawk
Subject: How to diaplay a popup menu?
Date Posted: 25 November 2004 at 10:08pm

Hello

When right-clicked toolbar, how to display a my popup menu?

Thanks.

Freehawk

 




Replies:
Posted By: Oleg
Date Posted: 01 December 2004 at 4:42am

variant 1. create custom command bars class and override GetToolbarsPopup method

in OnCreate:

class CMyCommandBars : public CXTPCommandBars
{

DECLARE_DYNCREATE()
}

...

InitCommandBars(RUNTIME_CLASS(CMyCommandBars))

variant 2. catch OnInitCommandsPopup (ON_XTP_INITCOMMANDSPOPUP()) and modify popup if it has Customize button.

 



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


Posted By: freehawk
Date Posted: 02 December 2004 at 1:43am

Thank you very much.

But I dont understand all. Could you give me a sample?

-Freehawk

Originally posted by oleg oleg wrote:

variant 1. create custom command bars class and override GetToolbarsPopup method

in OnCreate:

class CMyCommandBars : public CXTPCommandBars
{

DECLARE_DYNCREATE()
}

...

InitCommandBars(RUNTIME_CLASS(CMyCommandBars))

variant 2. catch OnInitCommandsPopup (ON_XTP_INITCOMMANDSPOPUP()) and modify popup if it has Customize button.

 



Posted By: Oleg
Date Posted: 02 December 2004 at 2:57am
https://forum.codejock.com/uploads/oleg/2004-12-02_025755_ps2.zip - 2004-12-02_025755_ps2.zip

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


Posted By: freehawk
Date Posted: 02 December 2004 at 7:59pm

Thank you very very much.

Now I have several questions .

1.With this way, can I judge the place where right-click button is clicked and display different popupmenu?

example: When right-clicked toolbar1, I display popupmenu1. and when right-clicked toolbar2, I will display popupmenu2.

2.I hope to display my popup menu only, not want to display "Customize", "Standard".. menu items in the popupmenu, How to realize it?

-Freehawk 

 

Originally posted by oleg oleg wrote:

https://forum.codejock.com/uploads/oleg/2004-12-02_025755_ps2.zip - 2004-12-02_025755_ps2.zip



Posted By: Oleg
Date Posted: 06 December 2004 at 7:16am

1. No, you can't

2. Call pPopupBar->GetControls()->RemoveAll();



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


Posted By: freehawk
Date Posted: 06 December 2004 at 7:34pm

Thank you for the reply.

About "1", is there any way to realize it?

-Freehawk

 

Originally posted by oleg oleg wrote:

1. No, you can't

2. Call pPopupBar->GetControls()->RemoveAll();



Posted By: Oleg
Date Posted: 07 December 2004 at 1:11am

1. Override CXTPCommandBars::ContextMenu as

void CMyCommandBars::ContextMenu(CPoint point)
{
 if (IsCustomizeMode())
  return;

 CXTPPopupBar* pPopup = GetToolbarsPopup();
 
 if (pPopup->GetControls()->GetCount() > 0)
 {
  pPopup->m_popupFlags = GetSite()->GetExStyle() & WS_EX_LAYOUTRTL? xtpPopupLeft: xtpPopupRight;
 
  pPopup->Popup(point.x, point.y, NULL);

  while ( pPopup->IsTrackingMode() )
  {
   AfxGetThread()->PumpMessage();
  }
 }
 pPopup->InternalRelease();
}

 

using point parameter you can find toolbar under this point



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


Posted By: freehawk
Date Posted: 07 December 2004 at 2:26am

Thank you.

How to do as "using point parameter you can find toolbar under this point" ?

use HitTest?

-Freehawk

 

 

Originally posted by oleg oleg wrote:

1. Override CXTPCommandBars::ContextMenu as

void CMyCommandBars::ContextMenu(CPoint point)
{
 if (IsCustomizeMode())
  return;

 CXTPPopupBar* pPopup = GetToolbarsPopup();
 
 if (pPopup->GetControls()->GetCount() > 0)
 {
  pPopup->m_popupFlags = GetSite()->GetExStyle() & WS_EX_LAYOUTRTL? xtpPopupLeft: xtpPopupRight;
 
  pPopup->Popup(point.x, point.y, NULL);

  while ( pPopup->IsTrackingMode() )
  {
   AfxGetThread()->PumpMessage();
  }
 }
 pPopup->InternalRelease();
}

 

using point parameter you can find toolbar under this point



Posted By: Oleg
Date Posted: 07 December 2004 at 5:30am
WindowFromPoint , ChildWindowFromPoint 

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


Posted By: freehawk
Date Posted: 07 December 2004 at 7:37pm

Thank you very much.

I will try it.

BTW, Could you give me a sample to realize it? It was big trouble to me for a long time.

-Freehawk

 

Originally posted by oleg oleg wrote:

WindowFromPoint , ChildWindowFromPoint 



Posted By: freehawk
Date Posted: 15 December 2004 at 1:52am

I tryed it, but I cannot know the place right-clicked.

Could you give me a sample to realize it? It was big trouble to me for a long time.

Thanks.

-Freehawk

Originally posted by freehawk freehawk wrote:

Thank you very much.

I will try it.

BTW, Could you give me a sample to realize it? It was big trouble to me for a long time.

-Freehawk

 

Originally posted by oleg oleg wrote:

WindowFromPoint , ChildWindowFromPoint 



Posted By: freehawk
Date Posted: 15 December 2004 at 10:12pm

Thank you very much.

I finished it.

-Freehawk

Originally posted by oleg oleg wrote:

WindowFromPoint , ChildWindowFromPoint 




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