Adding to context menu in Word

Add-in Express™ Support Service
That's what is more important than anything else

Adding to context menu in Word
How do I position the new item where I want it? 
Nicholas Glasier


Guest


I used the Demo to successfully add a new menu to Words Text Context menu, and it appeared just fine at the bottom of the menu.
I assumed that this was because the Before parameter was zero.

Popup := TxtCommndBar.Controls.Add(adxPopup,'POPUP_TAG_1', 0, true).AsPopup

So I used the BuiltinControlsScanner to get the ID of the Font menu item and change the zero to 253 (Font menus Office ID), but this resulted in an index error when the menu was being built in the AddinModuleStartUpComplete event.

Because it was an index error I thought maybe I needed to use 4 instead, as the font menu item is the fourth item to show. No error, but my new menu is still at the bottom of the list.

Is there any way to put it where I want it using the methods in your demo, or do I have to use another method altogether?

Regards Nick
Posted 17 Mar, 2005 15:53:11 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

Which demo are you using? I'll revise and update it and let you know.


Posted 18 Mar, 2005 06:44:51 Top
Nicholas Glasier


Guest


Hi Dmitry,

I got the demo using this link:
http://www.add-in-express.com/projects/adx-word-context-menu.zip

from this message:
http://www.add-in-express.com/forum/read.php?FID=1&TID=287&MID=1476#message1476

It works just fine as is but I'd like to move my popup menu item further up the text menu.

Regards Nick
Posted 18 Mar, 2005 16:43:47 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

I have just updated the demo. Please have a look.
http://www.add-in-express.com/projects/adx-word-context-menu.zip


Posted 19 Mar, 2005 08:39:05 Top
Nicholas Glasier


Guest


Thanks Dmitry, that did exactly what I wanted. I'm assuming that 4 didn't work as an index number because the Paste menu item has it's end group property set to true, and the font menu item has it's Begin Group property set to true as well. Both are being drawn in the same place which is why I only see one normally, but get both when an new item is inserted, without setting any of its group properties. Would that be right?

Thanks again Nick
Posted 20 Mar, 2005 02:33:42 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

I understand what you are speaking about but can't figure out any plausible explanation. I recommend you setting BeginGroup to True in your code.


Posted 20 Mar, 2005 09:37:53 Top
Nicholas Glasier


Guest


Sorry Dmitry, I guess I didn't make myself clear. Your demo worked perfectly, and gave me exactly the result I was looking for, I was just trying to figure out why you used an index value of 5 rather than 4. I wondered if the existance of a separator made the difference, and suggested that if the Paste menu item and the font menu item both had separators (one after and one before), it would account for the fact that your sample gave me two separators (which was what I wanted) without having to create one itself.

Regards Nick
Posted 20 Mar, 2005 15:43:55 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

I was just trying to figure out why you used an index value of 5 rather than 4.

The Before parameter is a number that indicates the position of the new control on the command bar. The new control will be inserted before the control at this position.

As for separators, you are probably right and both standard buttons have BeginGroup=True but I am not sure this is true for all Word versions. That is why I recommend doing this manually, i.e. set BeginGroup := True in your custom control.

Posted 21 Mar, 2005 08:48:50 Top
Sport DVD sets


Guest


Greate site. Thank you :)
Posted 30 Oct, 2005 02:25:30 Top