HQue wrote: ↑Mon Jul 28, 2025 7:47 am
Do you know by any chance how to add that icon to the "Home" ribbon and also to the "Annotations" ribbon as well?
And I want to add it next to the normal stamp icon in "Annotations" > "Drawing", too.
image.png
I think the first step to adding items to the ribbon is to run the following (from the examples published by Tracker):
Code: Select all
/************************************************************************
To see the actual Classic/Ribbon UI structure you may use the
following script:
************************************************************************/
function FancyMenuList(m, nLevel) {
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
var n = m.cName;
if (n == "") n = "-----"
console.println(s + n);
if (m.oChildren != null)
for (var i = 0; i < m.oChildren.length; i++)
FancyMenuList(m.oChildren[i], nLevel + 1);
}
var m = app.listMenuItems(); //to get list of items inside ClassicUI.MenuBar or inside the RibbonUI,
// also the optional cName parameter can be used to get items-list of certain menu/toolbar/tab
//var m = app.listToolbarButtons(); // to get list of items inside the Addon toolbar
for (var i = 0; i < m.length; i++) FancyMenuList(m[i], 0);
Save the output from that as a text file so it's easier to find out what names to use for each of the ribbon or menu items. Looking down that output, and searching for "stamp", we find:
Code: Select all
...
rbar.comment.drawing.part1
cmd.tool.annot.stamp
cmd.stampsList
cmd.view.stamps
rbar.comment.drawing.part2
Annots:Tool:InkMenuItem
cmd.toolStylesList
cmd.view.commentStyles
cmd.tool.annot.eraser
...
So if you want it after "cmd.view.stamps" you'd want to put it before "rbar.comment.drawing.part2". Looking up higher, we can see this is all part of the "rbar.comment.drawing" sub-menu so, add the following lines after the ones you already have (I commented out the oIcon line so I could test it):
Code: Select all
app.addSubMenu({
cName: "dyn.Stempel.1",
cParent: "-",
cRbParent: "rbar.comment.drawing", // add to comment ribbon drawing sub-menu
nRbPos: "rbar.comment.drawing.part2",
bPrepend: true, // put it in front
bNewRbGroup: true, // this is a new button group
nRbGroupStyle: 4, // large button, layout left-to-right
});
// this actually adds the menu item. Use the above cName as the cRbParent
app.addMenuItem({
cName: "dynStamp",
cUser: "Prüfstempel",
cTooltext: "Add stamp",
cEnable: true,
cExec: "executeStampFct(this)",
// oIcon: stampIconLarge,
// set the previously defined sub-menu as the parent
cParent: "dyn.Stempel.1",
nRbSepStyle: 2
});