A way to disable certain categories in Preferences menu?

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
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

A way to disable certain categories in Preferences menu?

Post by docu-track99 »

Hello folks,

I would like to have control over what preferences users have access to; there are some preferences in there that just don't seem useful for my users. Is there a way to disable access to certain categories within that menu? If so, could you provide an example by any chance?

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

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Hello docu-track99,

Yes it is possible. Though it will be available from the next build (317) - we've encountered several bugs that should be fixed. When they will be fixed I'll write you a sample. The code itself is short and not problematic.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Hello docu-track99,

We've updated our inner code, so this will be available from the next build (317). Here's the sample that you can paste and try in our FullDemo solution:

Code: Select all

//Callback that will allow you to gather all of the property sheets tabs
class EnumPropSheetsPagesCallback : PDFXEdit.IUIX_EnumPropSheetPagesCallback
{
	public void OnPropSheetPage(PDFXEdit.IUIX_PropSheets pHost, string sParentID, string sPageID)
	{
		//Adding each tab to the list so that we can manipulate each of them
		m_aIDs.Add(sPageID);
	}

	public List<string> m_aIDs = new List<string>();
}


private void pdfCtl_OnEvent(object sender, AxPDFXEdit._IPXV_ControlEvents_OnEventEvent e)
{
///
//...
///
if (e.nEventID == nIDS[(int)IDS.e_beginPropDialog])
{
	//Getting property sheets from the event data
	PDFXEdit.IUIX_PropSheets ps = (PDFXEdit.IUIX_PropSheets)e.pFrom;
	//In our case we'll modify the Application Preferences property sheet
	if (ps.ID == "DlgAppPrefs")
	{
		EnumPropSheetsPagesCallback cb = new EnumPropSheetsPagesCallback();
		//Here we'll have list of all of the property sheets pages thus we can delete by name or index
		ps.EnumPages(cb);
		//In this example, we'll leave only first 3 property sheets
		for (int i = cb.m_aIDs.Count - 1; i >= 3; i--)
		{
			//Removing pages by index
			ps.RemovePage(cb.m_aIDs[i]);
		}
	}
}
///
//...
///
}
HTH,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
chavas
User
Posts: 141
Joined: Tue Mar 15, 2016 12:21 pm

Re: A way to disable certain categories in Preferences menu?

Post by chavas »

Hi Alex,

Have you updated the new build with this feature. At which position in Enum IDS should I add "e_beginPropDialog"
It is used in this code-

if (e.nEventID == nIDS[(int)IDS.e_beginPropDialog])

I keep getting error.

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

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Hello chavas,

Are you trying that with FullDemo project? Be sure that you've added that event to the IDS enumeration. Also, send what kind of error are you getting.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
chavas
User
Posts: 141
Joined: Tue Mar 15, 2016 12:21 pm

Re: A way to disable certain categories in Preferences menu?

Post by chavas »

This is my ID enum...its in vb.net...Let me know where I am going wrong.....
Public Enum IDS

''// cmdbars
cmdbar_menubar
cmdbar_standard
cmdbar_file
cmdbar_rotateView
cmdbar_zoom
cmdbar_pageNav
cmdbar_contentEditing
cmdbar_pageLayout
cmdbar_docOptions
cmdbar_commenting
cmdbar_measurement
cmdbar_properties
cmdbar_launchApp
cmdbar_addon

'// panes/views
pageThumbnailsView
bookmarksView
contentsView
attachmentsView
signaturesView
commentsView
layersView
pdfNamedDestsView
propertiesView
searchView
stampsView
commentStylesView
panzoomView

_op_begin_

''// print
op_document_printPages

''// new doc
op_newBlankDoc
op_imagesToDoc
op_textToDoc
op_combineDocs

''// pages
op_document_insertPages
op_document_insertEmptyPages
op_document_deletePages
op_document_extractPages
op_document_replacePages
op_document_cropPages
op_document_resizePages
op_document_addWatermarks

'' // export comments & fields
op_document_summarizeAnnots
op_document_exportCommentsAndFields

'' // import comments & fields
op_document_importCommentsAndFields

''// export
op_document_exportToImages

_op_end_

_e_begin_

''// events
e_activeDocChanged
e_document_modStateChanged
e_document_sourceChanged
e_pagesView_endLayoutChanging
e_uiLanguageChanged
e_beginPropDialog

_e_end_

_last_
End Enum
chavas
User
Posts: 141
Joined: Tue Mar 15, 2016 12:21 pm

Re: A way to disable certain categories in Preferences menu?

Post by chavas »

I get an "InvalidOperation Exception" with a message-Value does not fall within the expected range.

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

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Hello chavas,

Do other enum values work correctly?
You can also try this:

Code: Select all

var evtID = pdfCtl.Inst.Str2ID("e.beginPropDialog", false);
if (e.nEventID == evtID)
//...
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: A way to disable certain categories in Preferences menu?

Post by docu-track99 »

Hi guys,

I am also using VB.Net. I never need to add events to the IDS enum. Here is what my code looks like for handling events. First you need to register the event.

Code: Select all

Private Sub RegisterEvent(ByVal EventString As String) 'Registers events to be listened for which raise pdfCtrl.OnEvent
        Try
            Dim newEventId = Me.pdfCtrl.Inst.Str2ID(EventString)
            pdfCtrl.EnableEventListening2(newEventId, True)
        Catch ex As Exception
            'Catch exception
        End Try
    End Sub
Then I just catch the event in my handler:

Code: Select all

 Private Sub PdfCtrl_OnEvent(ByVal sender As Object, ByVal e As AxPDFXEdit._IPXV_ControlEvents_OnEventEvent) Handles pdfCtrl.OnEvent
        Try
            Select Case e.nEventID

                Case pdfCtrl.Inst.Str2ID("e.activeDocChanged")
            End Select

        Catch ex As Exception
            'Catch exception
        End Try
    End Sub
Hope it helps,
Doc.It Development
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Thanks for your example, docu-track99 =)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
chavas
User
Posts: 141
Joined: Tue Mar 15, 2016 12:21 pm

Re: A way to disable certain categories in Preferences menu?

Post by chavas »

Thanks..its working now...:)
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Glad to hear that chavas.
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: A way to disable certain categories in Preferences menu?

Post by RMan »

Also if you don't want to deal with the callback and know the string ID of the page you can simplify it to.

private void pdfCtl_OnEvent(object sender, AxPDFXEdit._IPXV_ControlEvents_OnEventEvent e)
{
///
//...
///
if (e.nEventID == nIDS[(int)IDS.e_beginPropDialog])
{
//Getting property sheets from the event data
PDFXEdit.IUIX_PropSheets ps = (PDFXEdit.IUIX_PropSheets)e.pFrom;
//In our case we'll modify the Application Preferences property sheet
if (ps.ID == "DlgAppPrefs")
{
ps.RemovePage("DlgAppPrefs.CustomUI");
}
}
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: A way to disable certain categories in Preferences menu?

Post by Sasha - Tracker Dev Team »

Thanks for your sample RMan
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply