Add item to Properties Menu

PDF-XChange Editor SDK for Developers

Moderators: Tracker Support, TrackerSupp-Daniel, Paul - Tracker Supp, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Add item to Properties Menu

Post by coblejesse » Wed May 29, 2019 7:50 pm

Hi Tracker,

I am trying to add the cmd.forms.highlight cmd to the Properties Main Toolbar but am not getting very far. I've searched through the forums and have not been able find how to add a button onto the Properties Toolbar that would then highlight the form fields. This is what I've came up with so far, but not sure what cmd name the properties tool bar is.

Code: Select all

PDFXEdit.IUIX_CmdBar cmdBar = ucPdfViewer1.PDFXEditor.Inst.ActiveMainFrm.View.MenuBar;
            int nFlatIndex = cmdBar.FlatFindFirstItemByCmdName("cmd.tools");
            PDFXEdit.IUIX_CmdItem cmdTools = cmdBar.FlatGetItem(nFlatIndex);
            PDFXEdit.IUIX_CmdMenu editFieldsMenu = cmdTools.SubMenu;

            cmd = ucPdfViewer1.GetIUIX_Cmd("cmd.forms.highlight");
            editFieldsMenu.InsertItem2(cmd.ID);
Attachments
2019-05-29 15_46_07-Window.png
2019-05-29 15_46_07-Window.png (5.72 KiB) Viewed 117 times

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Add item to Properties Menu

Post by Sasha - Tracker Dev Team » Thu May 30, 2019 8:46 am

Hello coblejesse,

This is how you can get to the Properties Toolbar:

Code: Select all

IUIX_CmdBar propBar = Inst.ActiveMainFrm.View.CmdBar["cmdbar.properties"];
Then use the IUIX_CmdBar::InsertItem() methid to insert the needed command to the needed position.
Do not forget to do all of the customizations in the lock/unlock block:

Code: Select all

Inst.LockCmdCustomizationEvent();
uiInst.CmdManager.LockAllPanesUpdates();
//...
uiInst.CmdManager.UnlockAllPanesUpdates();
Inst.UnlockCmdCustomizationEvent();
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Re: Add item to Properties Menu

Post by coblejesse » Thu May 30, 2019 3:43 pm

Thanks Alex,

I used your code and have tried adding the existing cmd.forms.highlight cmd to the propBar and get no errors, but nothing shows up in the properties bar. I've also tried adding a new cmd to it as well and get the same results, and as well as trying to add a CmdItemBox with a new CmdItem. I get no errors in any of these, but the cmd does not show up in the properties bar. Should I be using a CmdItem within a CmdBox, or just a cmd?

Code: Select all

IUIX_CmdBar propBar = ucPdfViewer1.PDFXEditor.Inst.ActiveMainFrm.View.CmdBar["cmdbar.properties"];
            ucPdfViewer1.PDFXEditor.Inst.LockCmdCustomizationEvent();
            ucPdfViewer1.uiInst.CmdManager.LockAllPanesUpdates();
            // create new cmd
            //cmd = ucPdfViewer1.GetIUIX_Cmd("cmd.forms.highlight");
            //cmdHandler = new PdfEditorCommandHandler(ucPdfViewer1.PDFXEditor.Inst);
            int nCmdHighlight2 = ucPdfViewer1.PDFXEditor.Inst.Str2ID("cmd.forms.highlight2", true);

            //PDFXEdit.IUIX_Cmd cmd1 = ucPdfViewer1.uiInst.CmdManager.Cmds.AddNew2(nCmdHighlight);
            PDFXEdit.IUIX_CmdItemBox cmdNewBox = propBar.InsertNewBox("cmd.forms.highlight2");
            //cmd1.Title = "Highlight";
            PDFXEdit.IUIX_CmdItem cmdNewItem = cmdNewBox.InsertItem2(cmd.ID);
            ucPdfViewer1.uiInst.CmdManager.UnlockAllPanesUpdates();
            ucPdfViewer1.PDFXEditor.Inst.UnlockCmdCustomizationEvent();

User avatar
Sasha - Tracker Dev Team
User
Posts: 4076
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Add item to Properties Menu

Post by Sasha - Tracker Dev Team » Fri May 31, 2019 2:22 pm

Hello Jesse,

The toolbar is reinitializing itself each time the selection changes. Thus you will have to add that command each time.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply