How do I disable the Status sub menu item?

PDF-XChange Editor SDK for Developers

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

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

How do I disable the Status sub menu item?

Post by asamrith@gmail.com »

I created 2 status submenu state item called -> PRMT Status and PRMT Priority. How do I dsable one of the sub menu item? Please see attachment for screen shot.

// this disable the status menu
PDFXEdit.IUIX_Cmd cmd = uiInst.CmdManager.Cmds.Find("cmd.annot.status");
cmd.offline = true;

// I try below but did not work
PDFXEdit.IUIX_Cmd cmd = uiInst.CmdManager.Cmds.Find("cmd.annot.status.PRMT Status");
cmd.offline = true;

thanks for any help or suggestion.
Attachments
disable_status_submenu.PNG
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How do I disable the Status sub menu item?

Post by Sasha - Tracker Dev Team »

Hello asamrith@gmail.com,

The command item state is being controlled by your custom command handler via the OnGetItemState method:
https://sdkhelp.pdf-xchange.com/vi ... tItemState

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: How do I disable the Status sub menu item?

Post by asamrith@gmail.com »

Sorry, the OnGetItemState is not working for me as the State is already selected or transition by the time this event, OnGetItemState is triggered. The status menu is used to selected a state of an annot. If I have multiple stsates, like here, I have PRMT Status and PRMT Priority and I'm just trying to disable one of the state menu item on the mouse right click event(e_beforeShowContextMenu) is clicked. If I do this, cmd = uiInst.CmdManager.Cmds.Find("cmd.annot.status"); cmd.offline=true, the whole state setting status menu is disabled and I only need to disable on of the state mentioned in attahed menu item.
Any other suggestions please?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How do I disable the Status sub menu item?

Post by Sasha - Tracker Dev Team »

Hello asamrith@gmail.com,

You have created two custom commands so they must have a command handler that controls them and their state. Can you show how you created them?
Also, naming the commands with Space symbol included is not a good practice.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: How do I disable the Status sub menu item?

Post by asamrith@gmail.com »

The menu are created when I add new states using the Adobe Javascript Collab. Below is the Javascript code passed to Collab to created the new status and menu.


// Remove the state model

Collab.removeStateModel("Review");
Collab.removeStateModel("ReviewStates");
Collab.removeStateModel("PRMTReviewStates");

// Create the state model

var myStates = new Object();

myStates["None"] = {cUIName: "None"};

myStates["Open-Fixed"] = {cUIName: "✔ Open-Fixed"};

myStates["Open-Rejected"] = {cUIName: "✖ Open-Rejected"};

myStates["Closed-Fixed"] = {cUIName: "☑ Closed-Fixed"};

myStates["Closed-Rejected"] = {cUIName: "☒ Closed-Rejected"};

Collab.addStateModel({

cName: "PRMTReviewStates",

cUIName: "PRMT Status",

oStates: myStates,

cDefault: "None"

});




// Remove the state model

Collab.removeStateModel("Review");
Collab.removeStateModel("ReviewStates");
Collab.removeStateModel("PRMTPriorityStates");

// Create the state model

var myStates = new Object();

myStates["High"] = {cUIName: "▲ High"};
myStates["Normal"] = {cUIName: "◯ Normal"};
myStates["Low"] = {cUIName: "▼ Low"};
Collab.addStateModel({

cName: "PRMTPriorityStates",

cUIName: "PRMT Priority",

oStates: myStates,

cDefault: "Normal"

});
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How do I disable the Status sub menu item?

Post by Sasha - Tracker Dev Team »

Hello asamrith@gmail.com,

Well, if you have created them from the JS, then you probably can somehow control their state via the JS too.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: How do I disable the Status sub menu item?

Post by asamrith@gmail.com »

what a great reply :) but thanks anyway. I found an acceptable workaround that is not elegant but I think will work. Again, thanks as always for all your help.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How do I disable the Status sub menu item?

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply