Mimic VisibleCmdPanes from code per MainFrame  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: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Mimic VisibleCmdPanes from code per MainFrame

Post by zarkogajic »

Hi,

I've been going through how to visually setup 2 (or more) instances of pxv_control (some having some panes/bars/command some not)...

Looking into (among other topics): viewtopic.php?t=29266#p114405

[Q1] How do I programmatically do "Control.VisibleCmdPanes = PXV_VisibleCmdPanes_All"

I've tried as example:

Code: Select all

  Inst.LockCmdCustomizationEvent;
  InstUI.CmdManager.LockAllPanesUpdates;
  PXV_Control.Frame.View.CmdPaneTop.Show;
  InstUI.CmdManager.UnlockAllPanesUpdates;
  Inst.UnlockCmdCustomizationEvent;
But nothing happens.

I want this part to be displayed:

image.png

[Q2] Visually, what are "CmdPaneTop", "CmdPaneLeft", "CmdPaneRight" and "CmdPaneBottom" of IPXV_MainView?

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

Re: Mimic VisibleCmdPanes from code per MainFrame

Post by Sasha - Tracker Dev Team »

Hello žarko,

Here are the samples that would prove useful:

Code: Select all

private void separateControlStylesToolStripMenuItem_Click(object sender, EventArgs e)
{
	pdfCtl.Inst.LockCmdCustomizationEvent();
	PDFXEdit.IUIX_Inst iuiInst = (PDFXEdit.IUIX_Inst)pdfCtl.Inst.GetExtension("UIX");
	iuiInst.CmdManager.LockAllPanesUpdates();

	PDFXEdit.IPXV_MainFrame firstMainFrame = pdfCtl.Inst.MainFrm[0];
	firstMainFrame.View.CmdPaneTop.Hide();
	firstMainFrame.View.CmdPaneLeft.Hide();
	firstMainFrame.View.CmdPaneRight.Hide();
	firstMainFrame.View.CmdPaneBottom.Hide();
	PDFXEdit.IPXV_MainFrame secondMainFrame = pdfCtl.Inst.MainFrm[1];
	secondMainFrame.View.CmdPaneTop.Show();
	secondMainFrame.View.CmdPaneLeft.Show();
	secondMainFrame.View.CmdPaneRight.Show();
	secondMainFrame.View.CmdPaneBottom.Show();
	iuiInst.CmdManager.UnlockAllPanesUpdates();
	pdfCtl.Inst.UnlockCmdCustomizationEvent();
}

public void InitializeTwoControls()
{
	//First frame will be with full Control functionality
	PDFXEdit.IPXV_MainFrame firstMainFrame = pdfCtl.Inst.MainFrm[0];
	PDFXEdit.IPXV_MainView firstMainView = firstMainFrame.View;
	PDFXEdit.IPXC_Document doc = pxcInst.OpenDocumentFromFile("D:\\TestFile.pdf", null, null);
	firstMainFrame.OpenDocFrom(doc);
	firstMainView.CmdPaneTop.Show();

	//Setting up preview frame
	PDFXEdit.IPXV_MainFrame secondMainFrame = pdfCtl.Inst.MainFrm[1];
	PDFXEdit.IPXV_MainView secondMainView = secondMainFrame.View;
	PDFXEdit.ICab openParams = pdfCtl.Inst.CreateOpenDocParams();
	PDFXEdit.ICabNode openParamsRoot = openParams.Root;
	openParamsRoot.SetBool("NewDocView", true);
	secondMainFrame.OpenDocFrom(doc, openParams);
	//Setting layout style for no tab bar
	PDFXEdit.IUIX_Layout layout = secondMainView.DocViewsArea.Panes.Layout;
	if (layout.Root.Count > 0)
		layout.Root[0].SetStyle((int)PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_HideOneTab | (int)PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_NoTabBar, (int)PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_HideOneTab | (int)PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_NoTabBar);
}
As for your second question - each of those can hold some child panes, command bars etc. For example - Pages View has a bottom control, the Documents View has properties pane on the right, attachments pane on the bottom and many other panes on the left.

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

Re: Mimic VisibleCmdPanes from code per MainFrame

Post by zarkogajic »

Thanks Alex,

But that code is exactly what I've tried - and it is not working.

That code would be working if VisibleCmdPanes was set to something - so the top pane would get visible (then one an hide what needs to be hidden).

I want to make the top pane visible without setting VisibleCmdPanes.

I'm saying that this code "only" does nothing:

Code: Select all

PXV_Control.Frame.View.CmdPaneTop.Show;
So again, I need to know what VisibleCmdPanes does - and I want to mimic it per MainFrame.

As for [Q2]: I was specifically asking for MainFrame's MainView. Seems only CmdPaneTop has something (menus, bars) inside.


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

Re: Mimic VisibleCmdPanes from code per MainFrame  SOLVED

Post by Sasha - Tracker Dev Team »

Hello žarko,

Why can't you set the VisibleCmdPanes setting and then hide all of the needed command bars? This will do the same but with reverse logic. Also, you cannot mimic the VisibleCmdPanes directly, as it uses many of our inner code methods that are not accessible via the SDK.


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

Re: Mimic VisibleCmdPanes from code per MainFrame

Post by zarkogajic »

Hi Alex,

VisibleCmdPanes is global. Once set it will change the appearance of all MainFrames.

Ok, just needed the confirmation that it cannot be done.

Every time I instantiate a new pxv_control (and set VisibleCmdPanes) I will iterate over all main frames and reset visibility of the needed ui elements.

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

Re: Mimic VisibleCmdPanes from code per MainFrame

Post by Sasha - Tracker Dev Team »

Hello žarko,

Well that's the only way of doing that I'm afraid.

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