How to disable a command like 'Exclusive Mode' on startup

PDF-XChange Editor SDK for Developers

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

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.
MaSeife
User
Posts: 19
Joined: Thu Jun 27, 2019 11:21 am

How to disable a command like 'Exclusive Mode' on startup

Post by MaSeife »

How do I programmatically disable the 'Exclusive Mode' (the crown button) on startup / initialization of the PDF-XChange? The command ID is cmd.tool.exclusiveMode but when I try something like

Code: Select all

getInst().Settings().SetBool("cmd.tool.exclusiveMode", false)
I get a 'com.sun.jna.platform.win32.COM.COMException: Falscher Parameter.(HRESULT: 80070057) (puArgErr=)'.

Am I just using the wrong ID or do I generally use the wrong approach for this? When calling it at the same code position for example with

Code: Select all

getInst().Settings().SetBool("Tools.Line.ExclusiveMode", false)
I don't get the error. But this is not the right key for the actual user case :-)
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: How to disable a command like 'Exclusive Mode' on startup

Post by Stefan - PDF-XChange »

Hello MaSeife,

I believe that this property is stored per type of tool, so you will likely need to get the active tool:
https://sdkhelp.pdf-xchange.com/vi ... ActiveTool
check it's exclusive mode:
https://sdkhelp.pdf-xchange.com/vi ... sExclusive
and toggle it once you know for which tool you want to apply that.

Kind regards,
Stefan
MaSeife
User
Posts: 19
Joined: Thu Jun 27, 2019 11:21 am

Re: How to disable a command like 'Exclusive Mode' on startup

Post by MaSeife »

Hallo Stefan,

when opening/initializing the app, there is neither an active document nor an active tool. Therefore the getActiveTool()-Method isn't really applicable at this moment and isExclusive() can't be called.

And even if it were I couldn't find a corresponding setExclusive()-method to deactivate the 'Exclusive Mode'.

Isn't it possible to get some useful object with the id 'cmd.tool.exclusiveMode'?

Regards,
Markus
MaSeife
User
Posts: 19
Joined: Thu Jun 27, 2019 11:21 am

Re: How to disable a command like 'Exclusive Mode' on startup

Post by MaSeife »

Hi Stefan,

after some trial and error and initially setting an empty document I found a solution :-) The following did what I needed:

Code: Select all

if (getActiveDocument().ActiveTool().IsExclusive(getActiveDocument())) {
	getInst().ExecUICmd("cmd.tool.exclusiveMode", getInst().ActiveMainFrm().Obj());
}
Regards,
Markus
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: How to disable a command like 'Exclusive Mode' on startup

Post by Stefan - PDF-XChange »

Hello Markus,

Glad to hear that you have figured it out!

Kind regards,
Stefan