Setting Split Pages Modal Window To Disable "Add Vertical Split"

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
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by plgoldman »

Normally when the "Split Pages" modal window appears on the right hand side the "Add Horizontal Split" and "Add Vertical Split" options are enabled. Is there a way to always have the "Add Vertical Split" option disabled?

I will comment that I have successfully used the field names in the "DlgTemplates.xml" file to disable options on a number of modal windows however, it seems that the "Add Horizontal Split" and "Add Vertical Split" options are children of a control which is a child of the modal window itself and cannot be directly referenced via the "dlgTemplates.xml" file.

As always, your help is appreciated.

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

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by Sasha - Tracker Dev Team »

Hello Paul,

Judging from this, you have the IUIX_Dialog:
viewtopic.php?f=66&t=30597&p=122214&hil ... og#p122214

Here's a C++ code snipped that shod work (pass the IUIX_Dilaog's object to this method):

Code: Select all

HRESULT RunThroughChildren(IUIX_Obj* pParent)
{
	ReturnInvArgOnNull(pParent);

	HRESULT hr = DS_OK;
	do
	{
		CComPtr<IUIX_ObjCollection> pCol;
		pParent->get_Children(&pCol);
		BreakOnIf0(!pCol, hr, S_FALSE);
		ULONG_T nCnt = 0;
		pCol->get_Count(&nCnt);
		DStringW sTmp;
		for (defSizeDVector i = 0; i < nCnt; i++)
		{
			CComPtr<IUIX_Obj> pChild;
			pCol->get_Item(i, &pChild);
			if (!pChild)
				continue;
			CComPtr<IUIX_ScrollContainer> pSC;
			if (_QueryImpl(pChild, pSC))
			{
				for (defSizeDVector j = 0; j < _UIX_CmdPaneSide_Last_; j++)
				{
					CComPtr<IUIX_CmdPane> pPane;
					pSC->get_CmdPane((UIX_CmdPaneSides)j, &pPane);
					if (!pPane)
						continue;
					ULONG_T nLinesCount = 0;
					pPane->get_Count(&nLinesCount);
					for (defSizeDVector k = 0; k < nLinesCount; k++)
					{
						CComPtr<IUIX_CmdLine> pLine;
						pPane->get_Item(k, &pLine);
						if (!pLine)
							continue;
						ULONG_T nBarsCount = 0;
						pLine->get_Count(&nBarsCount);
						for (defSizeDVector b = 0; b < nBarsCount; b++)
						{
							CComPtr<IUIX_CmdBar> pBar;
							pLine->get_Item(b, &pBar);
							if (!pBar)
								continue;
							CComPtr<IUIX_CmdItem> pItem;
							pBar->FindFirstItemByCmdName(L"cmd.splitPages.addVertical", &pItem);
							if (pItem)
								pItem->Delete();
						}
					}
				}
			}
			hr = RunThroughChildren(pChild);
		}
	} while (false);
	return hr;
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by plgoldman »

Alex,

I really appreciate the code sample you sent in answer to my query. However, I realize that I did not word my original question properly. Rather then "disable" the "Add Vertical Split" option I am wondering if there is a way for the split page modal pop up to appear with the "Add Horizontal Split" already selected and the red horizontal split indicator showing so that all the user need do is move it to the desired position and click on "OK."

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

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by Sasha - Tracker Dev Team »

Hello Paul,

Do you mean that you want to execute Add Horizontal Split command on the dialog start?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by plgoldman »

Hi Alex,

The short answer to your question is yes. To elaborate, when the end user first clicks on the "Page Split" button in our UI the standard "Split Pages" modal dialog pop up appears with the options on the bottom half of the left side pre-selected and "disabled" so that all users make use of the same settings; this is accomplished through the use of an "Event Monitor" routine constructed with your help and using the values in the "DlgSplitPages" template in the DlgTemplates.xml file.

What we would like in addition to this is for the dialog to appear with a "Horizontal Split" bar at the 50% position on the page in the Preview Page box. With this all the user would need to do is position the split bar where they want it to be and click on OK. I know it's pretty simple to just click on the "Add Horizontal Split" but that involves a mouse action and the goal of our application is to minimize as much as possible the physical interaction between the user and the screen thereby increasing throughput.

Interestingly in the current environment I've noticed that after the first "Page Split" is performed each time the "Page Split" button is clicked, the dialog opens with the last defined horizontal split bar displayed. Basically we'd like to have an "initial" horizontal split bar displayed the first time that the "Page Split" button is clicked.

A final note, we don't want the "Add Vertical Split" button removed. It is hardly every used but that doesn't mean never.

If possible, I would appreciate any code samples you might supply to be written in C#.

Again, thanks for your time on our issues.

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

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by Sasha - Tracker Dev Team »

Hello Paul,

This is how that command can be executed codewise:

Code: Select all

HRESULT PXV::RunThroughChildren(IUIX_Obj* pParent)
{
	ReturnInvArgOnNull(pParent);

	HRESULT hr = DS_OK;
	do
	{
		CComPtr<IUIX_ObjCollection> pCol;
		pParent->get_Children(&pCol);
		BreakOnIf0(!pCol, hr, S_FALSE);
		ULONG_T nCnt = 0;
		pCol->get_Count(&nCnt);
		DStringW sTmp;
		for (defSizeDVector i = 0; i < nCnt; i++)
		{
			CComPtr<IUIX_Obj> pChild;
			pCol->get_Item(i, &pChild);
			if (!pChild)
				continue;
			CComPtr<IUIX_ScrollContainer> pSC;
			if (_QueryImpl(pChild, pSC))
			{
				for (defSizeDVector j = 0; j < _UIX_CmdPaneSide_Last_; j++)
				{
					CComPtr<IUIX_CmdPane> pPane;
					pSC->get_CmdPane((UIX_CmdPaneSides)j, &pPane);
					if (!pPane)
						continue;
					ULONG_T nLinesCount = 0;
					pPane->get_Count(&nLinesCount);
					for (defSizeDVector k = 0; k < nLinesCount; k++)
					{
						CComPtr<IUIX_CmdLine> pLine;
						pPane->get_Item(k, &pLine);
						if (!pLine)
							continue;
						ULONG_T nBarsCount = 0;
						pLine->get_Count(&nBarsCount);
						for (defSizeDVector b = 0; b < nBarsCount; b++)
						{
							CComPtr<IUIX_CmdBar> pBar;
							pLine->get_Item(b, &pBar);
							if (!pBar)
								continue;
							CComPtr<IUIX_CmdItem> pItem;
							pBar->FindFirstItemByCmdName(L"cmd.splitPages.addHorizontal", &pItem);
							if (pItem)
							{
								CComPtr<IUIX_Cmd> pCmd;
								pItem->get_Cmd(&pCmd);
								if (pCmd)
								{
									CComPtr<IUIX_CmdHandler> pHandler;
									pCmd->get_Handler(&pHandler);
									if (pHandler)
										pHandler->OnNotify(UIX_CmdNotify_Exec, pCmd, nullptr, pParent, 0);
								}
									
							}
						}
					}
				}
			}
			hr = RunThroughChildren(pChild);
		}
	} while (false);
	return hr;
}
But the easiest way would be to catch the operation parameters before the operation execution, alter them and then the dialog would be shown. The problem is that this operation is not yet available for the SDK in the current build. I will add it to the operations list so that it can be used like that.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by plgoldman »

Alex,

Once more thank you so much for your help. I'll "play around" with the code you sent. I'll also try out your suggested approach once you've added it to the operations list which if I understand your response will be available with the next SDK build.

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

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by Sasha - Tracker Dev Team »

Hello Paul,

I've just checked - the operation is available and I even gave you a sample on how to work with it:
viewtopic.php?f=66&t=30597&p=122197&hilit=split#p122197
And then you have this event:
viewtopic.php?f=66&t=28949&p=112387&hil ... te#p112387
You basically will need to see whether there is one element in array of the splits (so no duplicates will be there) and add it if you need. Then the code that I've shown you won't be necessary.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by plgoldman »

HI Alex,

Just found your follow up. I'll check it all out.

Thanks again,
Paul
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Setting Split Pages Modal Window To Disable "Add Vertical Split"

Post by Will - Tracker Supp »

:)
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Post Reply