IUIX_CmdItem State

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
JeroenG
User
Posts: 16
Joined: Tue Feb 14, 2017 2:18 pm

IUIX_CmdItem State

Post by JeroenG »

Hi,

Is there a way to get the state of a command in one of the menu's.

For example the state of Bookmarks item in the View menu.
Image

I'm trying to find the IUIX_CmdItem. I thought something like this, but it is not working.

Code: Select all

IUIX_CmdBar cmdBar = pdfCtl.Inst.ActiveMainFrm.View.MenuBar;
int idx = cmdBar.FlatFindFirstItemByCmdID(cmdId);
IUIX_CmdItem cmd = cmdBar.FlatGetItem(idx);

return cmd.State == UIX_CmdItemState.UIX_CmdItemState_Checked | cmd.State == UIX_CmdItemState.UIX_CmdItemState_CheckedInd;
To be clear, I do not want to know if the Bookmarks pane is visible.
I have made a custom command in the View menu. I want to know what the state of that command item is.

Jeroen
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: IUIX_CmdItem State

Post by Tracker Supp-Stefan »

Hello Jeroen,

I deleted the duplicate topic you posted in the end user section of the forums, so that only the correct one remains.

Bookmarks is one of the Editor panes, so you can get them all here:
https://sdkhelp.pdf-xchange.com/vie ... View_Panes

And then check the "IsVisible" property for each of them:
https://sdkhelp.pdf-xchange.com/vie ... Collection

Cheers,
Stefan
JeroenG
User
Posts: 16
Joined: Tue Feb 14, 2017 2:18 pm

Re: IUIX_CmdItem State

Post by JeroenG »

Hi Stefan,

That doesn't answer my question at all.

Like I said
To be clear, I do not want to know if the Bookmarks pane is visible.
I want to find the IUIX_CmdItem in the menu.
So I can check the State property of the IUIX_CmdItem.

Jeroen
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: IUIX_CmdItem State

Post by Tracker Supp-Stefan »

Hello Jeroen,

The bookmarks command will be checked when the bookmarks pane is turned on, or unchecked otherwise.
Only those commands that will open a new pane will have a check mark next to them. Others will just execute the relevant command associated with them (e.g. open a new window for cropping a page in the case of Document -> Crop pages).
So there is no "checked" state really for menu commands - this check mark is just a visual indicator illustrating whether the respective pane is already on or off.

Or is it a different state that you want to check?

Regards,
Stefan
JeroenG
User
Posts: 16
Joined: Tue Feb 14, 2017 2:18 pm

Re: IUIX_CmdItem State

Post by JeroenG »

Hi,

The Bookmarks was just an example. But probably a wrong example.

I want to know the state of my custom menu item (what nothing has to do with a pane)
Image

Maybe this is a good example. Is it possible to find out if the Link Creation Tool is checked or not?
Image

I know it is possible to get the state of an item from one of the command bars.
For example the Actual Size:

Code: Select all

private UIX_CmdItemState GetCommandState()
{
	var cmdbar = pdfCtl.Inst.ActiveMainFrm.View.CmdBar("cmdbar.zoom");
	var cmd = cmdbar.FindFirstItemByCmdName("cmd.zoom.level.actual");
	return (UIX_CmdItemState)cmd.State;
}
Image

I think this should be possible for menu items too. Isn't it?

Jeroen
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: IUIX_CmdItem State

Post by Tracker Supp-Stefan »

Hello Jeroen,

Thanks for the clarification.
I've checked with a colleague from the dev team - and it seems like we will need to pass it along to a colleague from the Canadian office.
I have just done so - and we will post back here as soon as we have further news!

Regards,
Stefan
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IUIX_CmdItem State

Post by Sasha - Tracker Dev Team »

Hello Jeroen,

I've updated the description of the interface - do read about it:
https://sdkhelp.pdf-xchange.com/vie ... IX_CmdMenu

Basically what you will need to do is to call the OnGetCmdState of the Command Handler of the needed Command.
In your case the Owner would be the IPXV_MainView:

Code: Select all

pdfCtl.Frame.View
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
JeroenG
User
Posts: 16
Joined: Tue Feb 14, 2017 2:18 pm

Re: IUIX_CmdItem State

Post by JeroenG »

Hi,

So it should be something like this?
Because this is not working.
Also passing pdfCtl.Frame.View as a IUIX_Obj is not possible.

Code: Select all

IUIX_Cmd cmd = _UIInst.CmdManager.Cmds.Find2(cmdId);
IUIX_CmdItem item = null; //No idea what this should be
IUIX_Obj owner = (IUIX_Obj)pdfCtl.Frame.View;
int state = 0;

cmd.Handler.OnGetItemState(cmd, item, owner, state);
Regards,
Jeroen
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IUIX_CmdItem State

Post by Sasha - Tracker Dev Team »

Hello Jeroeng,

The IPXV_MainView extends IPXV_View interface that extends IUIX_ObjImpl interface. So basically you will have to do

Code: Select all

pdfCtl.Frame.View.Obj
Also, the IUIX_CmdItem parameter should be null.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply