Position button on Open dropdown of QAT

Position button on Open dropdown of QAT

Anonymous
Not applicable
885 Views
8 Replies
Message 1 of 9

Position button on Open dropdown of QAT

Anonymous
Not applicable

Is it possible to position a button on the Open dropdown of the Quick Access Toolbar?

 

The following works:

 

CommandControls AssemblyQATControls = oAssemblyRibbon.QuickAccessControls;
CommandControls PartQATControls = oPartRibbon.QuickAccessControls;
CommandControls ZeroQATControls = oZeroDocRibbon.QuickAccessControls;
 
AssemblyQATControls.AddButton(MyButton, truetrue"AppFileNewCmd");
PartQATControls.AddButton(MyButton, truetrue"AppFileNewCmd");
ZeroQATControls.AddButton(MyButton, truetrue"AppFileNewCmd");

but not this:

 

ZeroQATControls.AddButton(MyButton, truetrue"NewFileTemplate4");

 

0 Likes
Accepted solutions (1)
886 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

Sorry, I mean the "New" dropdown.

 

0 Likes
Message 3 of 9

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

did you mean you can add your button to [New] menu if it is Assembly Ribbon or Part Ribbon, but cannot in Zero Ribbon? 

0 Likes
Message 4 of 9

Anonymous
Not applicable

No, I am saying that I can add a button (to any ribbon) *after* the New dropdown, but I cannot add a button (to any ribbon) to the New dropdown itself (where my button is not visible until the New dropdown is opened).

 

0 Likes
Message 5 of 9

xiaodong_liang
Autodesk Support
Autodesk Support

Hope the code below and the snapshot explains:

 

Sub test()

 

Dim ZeroQATControls As CommandControls

Set ZeroQATControls = ThisApplication.UserInterfaceManager.Ribbons("ZeroDoc").QuickAccessControls
Dim o As Object
Set o = ZeroQATControls(1)

o.ChildControls.AddButton ThisApplication.CommandManager.ControlDefinitions("AppFileSaveAsCmd")

End Sub

0 Likes
Message 6 of 9

Anonymous
Not applicable
Hi Xiaodong, can you give that to me in C#?  For some reason I can't convert it myself.
 
0 Likes
Message 7 of 9

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi michael.collins2,

 

I am a little bit astonished it would be difficulty for you with these lines. Anyway, I took a tool to convert it and modify to meet the syntax of C#. Although it is not neccessary for these few lines, but just in case you have more codes need to be converted in the future:

 

http://www.developerfusion.com/tools/convert/vb-to-csharp/

 

public void test()
{

 CommandControls ZeroQATControls =   ThisApplication.UserInterfaceManager.Ribbons["ZeroDoc"].QuickAccessControls;

 object o = ZeroQATControls[1];

 o.ChildControls.AddButton(ThisApplication.CommandManager.ControlDefinitions["AppFileSaveAsCmd"]);

}
0 Likes
Message 8 of 9

Anonymous
Not applicable

Thank you.  I tried a different tool but the output of that tool would not compile.  I guess that tool was not familiar with the Inventor data model and got confused between what was a method and what was an array.

 

Let me try this code.  Thanks.

0 Likes
Message 9 of 9

Anonymous
Not applicable

 

Hi Xiaodong, yes that was a good start.  I just had to cast o as a CommandControl, and use my button.  Here is what I ended up with:

 

          CommandControl oA = AssemblyQATControls[1];
          oA.ChildControls.AddButton(dokument_Konfigurator);
          CommandControl oP = PartQATControls[1];
          oP.ChildControls.AddButton(dokument_Konfigurator);
          CommandControl oZ = ZeroQATControls[1];
          oZ.ChildControls.AddButton(dokument_Konfigurator);
0 Likes