Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Context Menu on MDI form control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Context Menu on MDI form control

 Post Reply Post Reply
Author
Message
sanddevil View Drop Down
Newbie
Newbie


Joined: 21 August 2007
Location: United Kingdom
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote sanddevil Quote  Post ReplyReply Direct Link To This Post Topic: Context Menu on MDI form control
    Posted: 28 August 2007 at 5:49am
Hi!! I've been trying to create a context menu using CommandBars ActiveX for the last 2 days but with no success. I've had a look through the samples and I can't see anything to help me. I am new to the product and fairly new to C++.
 
I would like to create a context menu on a control on an MDI client form. A right click would produce a menu list with the usual "Copy/Cut/Paste" plus a few others.
 
Can anyone paste a few lines of code to give me a start please? All help gratefully received. I'm coding in C++.Net  but could probably translate any snippets from C# or VB.
 
Many thanks in advance.
Back to Top
apuhjee View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 September 2005
Location: United States
Status: Offline
Points: 130
Post Options Post Options   Thanks (0) Thanks(0)   Quote apuhjee Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2007 at 11:42am

Here is some code that is used to close tab workspace tabs.  Other context menus will look similar.

Cheers ~ jp
 
 
private void tabWorkspace_RClick(XtremeCommandBars.TabControlItem Item)
{
     if (Item != null)
     {
          tabCurrent = Item;
          CommandBar popup = CommandBars.Add("Context Menu", XtremeCommandBars.XTPBarPosition.xtpBarPopup);
          CommandBarControl control = popup.Controls.Add(XTPControlType.xtpControlButton, ID.ID_TAB_CLOSE, "Close", null, false);
          popup.ShowPopup(XtremeCommandBars.XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null);
     }
}
I like mathematics because it is not human and has nothing particular
to do with this planet or with the whole accidental universe — because,
like Spinoza's God, it won't love us in return.
Back to Top
sanddevil View Drop Down
Newbie
Newbie


Joined: 21 August 2007
Location: United Kingdom
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote sanddevil Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2007 at 1:28pm
Hi! Many thanks jp - much appreciated. My C++ code actually looks the same as yours but a problem persists. When I call CommandBars.Add, the returned CommandBar popup is a null pointer  - which suggests to me the Add call is not working.
 
A quick look at the debugger confirms this - the count is set to zero controls so Add definitely failed.   I don't have a clue why. Any ideas?
 
Cheers!
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.046 seconds.