Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to diaplay a popup menu?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to diaplay a popup menu?

 Post Reply Post Reply
Author
Message
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post Topic: How to diaplay a popup menu?
    Posted: 25 November 2004 at 10:08pm

Hello

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

Thanks.

Freehawk

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 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
Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 02 December 2004 at 2:57am
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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:

2004-12-02_025755_ps2.zip

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 06 December 2004 at 7:16am

1. No, you can't

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

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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();

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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 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
Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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 December 2004 at 5:30am
WindowFromPoint , ChildWindowFromPoint 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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 

Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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 

Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post Posted: 15 December 2004 at 10:12pm

Thank you very much.

I finished it.

-Freehawk

Originally posted by oleg oleg wrote:

WindowFromPoint , ChildWindowFromPoint 

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.156 seconds.