PXV_VisibleCmdPanes_All vs cmd.view.toggleAllCmdBars vs multiple instances of PXVControl

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

PXV_VisibleCmdPanes_All vs cmd.view.toggleAllCmdBars vs multiple instances of PXVControl

Post by zarkogajic »

Hi Support,

Couple of Q's raised here:

Having 2 instances of PXV Control.

1. First instantiated + setting PXV_VisibleCmdPanes_All.
2. cmd.view.toggleAllCmdBars executed - all bars get hidden.

Now, instantiating second instance, again + PXV_VisibleCmdPanes_All

Since PXV_VisibleCmdPanes_All is global -> this will reset the visibility of all MainView bars in the first pxvControl instance.

I need to hide back the bars hidden via toggleAllCmdBars in the first instance.

[Q1] But, how do I know, i.e. what "setting" to read from the first instance, to know that toggleAllCmdBars was executed and all bars were hidden (before global PXV_VisibleCmdPanes_All made them visible again)?

[Q2] And what does toggleAllCmdBars actually do? It does not unhide the bars that I've hidden from code using IUIX_CmdBar.Hide.

[Q3] Is it altering the VisibleCmdBars of PXVControl? If so, where is that value stored? In some Instance setting (since global)?

[Q4] And finally: toggleAllCmdBars does not hide my custom added bars - is that expected?

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

Re: PXV_VisibleCmdPanes_All vs cmd.view.toggleAllCmdBars vs multiple instances of PXVControl

Post by zarkogajic »

Hi Support,

I've played a bit more here .. and here's what I figured out ...

Executing cmd.view.toggleAllCmdBars changes the value of VisibleCmdBars from default PXV_VisibleCmdBars_All to "0" (no bars visible) for ALL pxvControl instances (because it is really not PXVControl related but instance related e.g. global).

If executed, and then reading it from one/any PXVControl the value is 0 (so all hidden). Now, when a new instance of PXVControl is created - it again defaults to PXV_VisibleCmdBars_All - so somehow the set value is not preserved as if not global (but acts as if is) - and all bars on all existing PXVControl instances are back to visible.

I'm now storing (custom handling cmd.view.toggleAllCmdBars via IUIX_CmdHandler) the value of VisibleCmdBars as my local field. When a new PXVControl is created I'm setting VisibleCmdBars for it to my internally stored value. Works.

So, Q1 and Q3 solved.

Still open questions:

[Q2] VisibleCmdBars does not unhide the bars that I've hidden from code using IUIX_CmdBar.Hide. I'm ok with this - just curious to know why ?

[Q4] toggleAllCmdBars does not hide my custom added bars. Again, I'm ok with it - just would be more at ease if this is confirmed to be "as designed".

-žarko
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 11222
Joined: Wed Jan 03, 2018 6:52 pm

Re: PXV_VisibleCmdPanes_All vs cmd.view.toggleAllCmdBars vs multiple instances of PXVControl

Post by Daniel - PDF-XChange »

Hello, zarkogajic

Sorry for the delay, It seems I missed this one when it came in. I have just reached out to the Dev team for their insight here, and will let you know once I hear from them.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2447
Joined: Thu Jun 30, 2005 4:11 pm

Re: PXV_VisibleCmdPanes_All vs cmd.view.toggleAllCmdBars vs multiple instances of PXVControl

Post by Vasyl - PDF-XChange »

[Q2] - because bar's visibility flag is calculated in this way:

Code: Select all

int flag = 0;
if (BarIsOnRibbon(bar))
   flag = PXV_VisibleCmdBars_MainView;
else if (BarIsInsidePagesViewContainer(bar))   
   flag = PXV_VisibleCmdBars_PagesView;

bool canShowBar = !bar.IsHidden && (flag == 0 || ((global.VisibleCmdBars & flag) != 0));
[Q4] - it should hide them, but it depends on where you put your toolbar. The PXV_VisibleCmdBars_MainView affects all toolbars on Ribbon, while PXV_VisibleCmdBars_PagesView - all toolbars around the pages view. So if you put your toolbar inside the Bookmarks pane, for example - it will not work for you...

Yes, toggleAllCmdBars alters the pdfCtl.VisibleCmdBars property. And the parameter pxvInst.Settings[L"CmdExtraOpts.BarsVisibility"] too.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1508
Joined: Thu Sep 05, 2019 12:35 pm

Re: PXV_VisibleCmdPanes_All vs cmd.view.toggleAllCmdBars vs multiple instances of PXVControl

Post by zarkogajic »

Hi Vasyl,

Couple of topics actually here, so I'll try to go one by one...

Please note: I'm working with multiple instances of the PXV_Control.

T1. Initial value of PXV_Control.VisibleCmdBars does not respect what's inside Inst.Settings['CmdExtraOpts.BarsVisibility'] at the moment of PXV_Control creation.

When the second (or any new) instance of PXV_Control is created, its VisibleCmdBars defaults to PXV_VisibleCmdBars_All regardless of what should be the current value of Inst.Settings['CmdExtraOpts.BarsVisibility'] (so this also somehow gets reset).

To test:

0. to start: no instances of PXV_Control exist
1. Create an instance of PXV_Control (PXV_VisibleCmdBars_All is default, set VisibleCmdPanes to PXV_VisibleCmdPanes_All)
2. Do toggleAllCmdBars
2.1. Inst.Settings['CmdExtraOpts.BarsVisibility'] gets set to "0" as expected
3. Instantiate a new PXV_Control
3.1. Inst.Settings['CmdExtraOpts.BarsVisibility'] returns PXV_VisibleCmdBars_All (and not 0)

So, somehow 'CmdExtraOpts.BarsVisibility' gets reset to default ("All") value.

T2. toggleAllCmdBars does not hide my injected IUIX_CmdBar

Here's how I do it:

0. to start: no instances of PXV_Control exist
1. Create PXV_Control
1.1. PXV_VisibleCmdBars_All is default, set VisibleCmdPanes to PXV_VisibleCmdPanes_All
2. Inject my custom bar into the MainView.CmdPaneTop next to "cmdbar.form", so here:
image.png
3. Do toggleAllCmdBars
4. Everything gets hidden except by bar, result:

image(1).png

NOTE: I am OK with this, as I am custom handling the toggleAllCmdBars and manually hiding my bar to fix this.

Just wanted to know this IS by design...

T3. toggleAllCmdBars does not hide my IUIX_CmdBar inside my CmdLine

My bar, my line (so, "extension" of T2):

image(2).png

Executing toggleAllCmdBars :

image(3).png

NOTE: I am OK with this. Just wanted to know this IS by design...

Edit (forgot to add):
T4. toggleAllCmdBars does not unhide Bars I've hidden

Nor I think it should, so also asking for "by design" answer...

1. Create PXV_Control
1.1. PXV_VisibleCmdBars_All is default, set VisibleCmdPanes to PXV_VisibleCmdPanes_All
2. Hide some Bars inside PXV_Control.Frame.View.CmdPaneTop using IUIX_CmdBar.Hide
3. Do toggleAllCmdBars
3.1. All bars are hidden - ok with this
4. Do toggleAllCmdBars
4.1. The bars I hidden in [2] are still hidden - so PXV_VisibleCmdPanes_All does not reset manually hidden bars.

Again, I'm also ok with this and am expecting this to work like that.

p.s.
To repeat:

I'm ok with how T2 and T3 work. I am custom handling everything and am hiding/unhiding my bars upon toggleAllCmdBars.

I'm also ok with how T1 works, as I am storing the value of 'CmdExtraOpts.BarsVisibility' internally now.

Just wanted the confirmation that you are aware of the above and that it is by design.



-žarko
You do not have the required permissions to view the files attached to this post.