![]() |
Context Menu on MDI form control |
Post Reply
|
| Author | |
sanddevil
Newbie
Joined: 21 August 2007 Location: United Kingdom Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: Context Menu on MDI form controlPosted: 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.
|
|
![]() |
|
apuhjee
Senior Member
Joined: 02 September 2005 Location: United States Status: Offline Points: 130 |
Post Options
Thanks(0)
Quote Reply
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. |
|
![]() |
|
sanddevil
Newbie
Joined: 21 August 2007 Location: United Kingdom Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
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!
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |