Missing Shim project

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

Missing Shim project
 
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Phil,

From looking at the code it looks like you are using the AdxCommandBarPopup control to create the menu option. Is that right?


Yes, you are right. In Office terms the File menu is an instance of CommandBarPopup.

I can't see how you specify that the menu item appears after the "Save As..." option. Where is that controlled?


Have a look at the ID property of popups. Have you found 30002? It is the ID of the File menu (pop-up). You can scan all command bars of any Office applications via our built-in controls scanner.
Posted 26 Jan, 2005 12:21:25 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Phil,

I made a misstake in my previous posting. Here is the correct answer.

I can't see how you specify that the menu item appears after the "Save As..." option. Where is that controlled?


I use the Before property of buttons. It turned out your button should be inserted before button 6 in the File menu.

Here you could face the problem. MS allows a user to customize command bars and menus and "SaveAs" can be placed on any command bars and menus (hypothesis!). And I don't know what I should suggest you in this case.
Posted 26 Jan, 2005 12:27:16 Top
Sven Heitmann




Posts: 193
Joined: 2004-08-23
Hi Phil,
Hi Eugene,

I had the same problem in my project:
I should place some new buttons behind some specific controls.

I get the position of the existing controls by their id, when the addin is loading.
Then I change the position of my buttons, so that they are behind/before these buttons.

So I am independent on the initial position of the existing controls.

However this is only working when the addin loads the first time because adx is caching all controls and only reloads them if their updatecounter changes.

See this Code

protected object FindControl(object cmdBar,int id) {
  if (cmdBar != null) {
    return (cmdBar as Office.CommandBar).FindControl(Type.Missing, id, Type.Missing, Type.Missing, true);
  }
  return null;
}

protected int IndexBehindControl(object cmdBar,int id) {
  Office.CommandBarControl oControl = null;
  int index = 0;
  try {
    oControl = FindControl(cmdBar,id) as Office.CommandBarControl;
    index = oControl.Index+1; 
  } 
  catch {}
  Utils.ReleaseComObject(oControl);
  return index;
}

protected int IndexBeforeControl(object cmdBar,int id) {
  Office.CommandBarControl oControl = null;
  int index = 0;
  try {
    oControl = FindControl(cmdBar,id) as Office.CommandBarControl;
    index = oControl.Index; 
  } 
  catch {}
  Utils.ReleaseComObject(oControl);
  return index;
}


and I use them as following


private void InitializePositions() {
  object oCmdBar = null;
  oCmdBar = this.FindCommandBarObj("Standard");
  if (oCmdBar != null) {
    _btnVerwaltung.Before = IndexBeforeControl(oCmdBar, 2520);
    _btnNeuesDokument.Before = IndexBehindControl(oCmdBar, 2520);
    _btnSaveAs.Before = IndexBehindControl(oCmdBar, 3);
    Utils.ReleaseComObject(oCmdBar);
  }
  oCmdBar = this.FindCommandBarObj("Formatting");
  if (oCmdBar != null) {
    _btnStyleStandard.Before = IndexBeforeControl(oCmdBar, 113);
    Utils.ReleaseComObject(oCmdBar);
  }
}
Best regards,

Sven Heitmann
Posted 27 Jan, 2005 02:14:28 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Hi Sven,

I'm glad to hear you from you.

Your solution is a great idea!

Now I see that we can add to ADXCommandBarControl properties like... BeforeID and AfterID. Your comments?
Posted 27 Jan, 2005 02:28:20 Top
Philip Street




Posts: 53
Joined: 2005-01-25
Sven - good idea!

Eugene - even better idea! Go go go!!!! :-)

Phil
Posted 27 Jan, 2005 04:03:22 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Phil,

I think we will publish build 1750 with this feature on Saturday.

Sven, thank you for your idea!
Posted 27 Jan, 2005 04:06:04 Top
Sven Heitmann




Posts: 193
Joined: 2004-08-23
You are welcome =)
Best regards,

Sven Heitmann
Posted 28 Jan, 2005 02:34:00 Top
Philip Street




Posts: 53
Joined: 2005-01-25
1) "Excellent, thanks for that. The only curious thing in Outlook is that the menu completely disappears when I select a folder type other then Mail..."

Any ideas what would cause this behaviour?


2) "I think we will publish build 1750 with this feature on Saturday."

How's the new build going? :-)


Cheers,

Phil
Posted 31 Jan, 2005 12:39:18 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
1) "Excellent, thanks for that. The only curious thing in Outlook is that the menu completely disappears when I select a folder type other then Mail..."

Any ideas what would cause this behaviour?


Philip, have a look at Developer's Guide. There are a lot of useful texts. The ItemTypes property for example :-)

2) "I think we will publish build 1750 with this feature on Saturday."

How's the new build going? :-)


We have to postpone the build till this Wednesday.
Posted 31 Jan, 2005 14:58:43 Top
Philip Street




Posts: 53
Joined: 2005-01-25
Philip, have a look at Developer's Guide. There are a lot of useful texts. The ItemTypes property for example :-)


I have but there appear to be a lot of properties (seen in the VS Object Browser) that are not mentioned in the PDF.

We have to postpone the build till this Wednesday.


No problem, I know what it's like... :-)

Cheers,

Phil
Posted 01 Feb, 2005 05:06:23 Top