Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)  SOLVED

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
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by zarkogajic »

Hi support,

I'm custom handling the "cmd.open" command so I can open duplicate copies of the same file (and do more stuff).

To do so, in IUIX_CmdHandler's OnNotify I'm looking for "pCmd.ID" (to match the "cmd.open" command id) and "nCommand" (to be UIX_CmdNotify_Exec). For the code to do what it needs to do I need to have access to the IPXV_MainView and this is returned by "pOwner.Impl". All working nice and smoothly....

But then, I'm also creating my own command bar by using IUIX_Inst's CreateCmdBar. For the pParent parameter I'm using IUIX_CmdPane (actually CmdPaneTop of MainFrame.View). I'm adding some commands to my command bar and all commands are added nicely and everything works.

However, when I add "cmd.open" to my bar, and I want to custom handle it of course, the conversion from "pOwner.Impl" to MainView fails with an error - so pOwner.Impl is not an IPXV_MainView.

It seems the pOwner.Impl returns the CommandPane object (IUIX_CmdPane) to which I am adding the command.

[Q] Can this be confirmed? If so, why is the owner of my custom added command(bar) the CommandPane where I add them, and those that are available by default are owned by MainView and not the CommandPane in which they are?

[Q] Can I be certain only those two options exist: the pOwner.Impl is either the IPXV_MainView (by default) or IUIX_CmdPane (for custom added commands to custom added command bar to a CommandPane)?

Also, the default "cmd.open"displays history:
image.png

[Q] Why the same command added through code (in custom bar, ok) does not?

image.png
image.png (15.3 KiB) Viewed 2196 times

[Q] Actually I do not want the history to be visible, so how to hide that "down triangle" button?


-žarko
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by zarkogajic »

To answer (a part of my question):

To get to the MainView from pOwner in OnNotify (of IUIX_CmdHandler), one can simply use (never mind who is and where hosting the command in question) :

Code: Select all

(IPXV_MainView) mv := IPXV_Inst.GetMainViewFromUIObj(pOwner, false);
The other two questions remain:

[Q1] Why the same command ("cmd.oepn") added through code (in custom bar, ok) does not (display the history)?

[Q2] Actually I do not want the history to be visible, so how to hide that "down triangle" button?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by Sasha - Tracker Dev Team »

Hello zarko,

To remove the arrow, you should remove the style from the command item itself (UIX_CmdItemStyle_HasPopup and UIX_CmdItemStyle_WholePopup)

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by zarkogajic »

Hi Alex,

Thanks.

I'm not sure of the proper usage of style setting (specifically when removing), can you give code here (not sure what would goes for style and what for style mask).

Btw, still why the "cmd.open" in my bar does not show the history popup?

zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by zarkogajic »

Hi support,

?

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

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)  SOLVED

Post by Sasha - Tracker Dev Team »

Hello žarko,

The cmd.open command has a menu.recents submenu, that holds the cmd.recentsList command (that is a custom resents list control) and also two more commands. Are you adding it along with the command?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by zarkogajic »

Hi Alex,

The thing is that when I added cmd.open to my bar it displayed the drop down arrow. Then I asked you about how to hide it (UIX_CmdItemStyle_HasPopup and UIX_CmdItemStyle_WholePopup) - somewhere along, without me removing those styles, the drop down arrow removed itself (?) - so basically at this time I'm ok with it.

I will close the topic and reopen with a different topic if something similar happens.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Custom handling the "cmd.open" command added to my custom bar (CreateCmdBar)

Post by Sasha - Tracker Dev Team »

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