Hide "Add New Tab" button always

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
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Hide "Add New Tab" button always

Post by lidds »

I want to hide the "Add New Tab" button that appears when you are working in multiple document mode.

I have seen the following post https://forum.pdf-xchange.com/ ... ab#p106813 and I am using the below code

Code: Select all

Dim layout As PDFXEdit.IUIX_Layout = Me.docPreview.Inst.MainFrm(0).View.DocViewsArea.Panes.Layout
            If layout.Root.Count > 0 Then
                layout.Root(0).SetStyle(0, CInt(PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_AddNewTabBtn))
            End If
But this does not seem to hide the button??

Also I want it to always be hidden even if only one document is shown, is this possible?

Thanks in advance

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

Re: Hide "Add New Tab" button always

Post by Sasha - Tracker Dev Team »

Hello Simon,

You've probably missed this one:
Note, that this will be only available when at least one document is already opened. Best to use this piece of code in the e_document_viewingStarted event.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Hide "Add New Tab" button always

Post by lidds »

Alex,

I did already have this in the e_document_viewingStarted and the event is being caught and the code is running. However the layout.Root.Count is always zero, even if I add documents using the "Add New Tab" button to load the document?

Code: Select all

        ElseIf e.nEventID = nIDS(CInt(IDS.e_document_viewingStarted)) Then
            ' Hide add new document button
            Dim layout As PDFXEdit.IUIX_Layout = Me.docPreview.Inst.MainFrm(0).View.DocViewsArea.Panes.Layout
            If layout.Root.Count > 0 Then
                layout.Root(0).SetStyle(0, CInt(PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_AddNewTabBtn))
            End If
Thanks

Simon
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Hide "Add New Tab" button always

Post by lidds »

Alex,

Instead of removing the "Add New Tab" can I capture the event? If so what event would it be?

Thanks

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

Re: Hide "Add New Tab" button always

Post by Sasha - Tracker Dev Team »

However the layout.Root.Count is always zero, even if I add documents using the "Add New Tab" button to load the document?
This is strange - should be > 0 when opening at least one document. Try doing that in the clean FullDemo project.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Hide "Add New Tab" button always

Post by lidds »

Alex,

I have checked the FullDemo and you are correct it works in there, untill you add a 2nd PDF Xchange controls to the FullDemo. Which is what I have in my application, when you have two PDF Xchange controls the layout.Root.Count is always zero

Thanks

Simon
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Hide "Add New Tab" button always

Post by lidds »

Alex,

Just FYI the only reason I have another PDF XChange control in my application is to convert MS word and other documents into PDF. Is it possible the convert documents using code without having a control on the form? If so this might solve some issues?

Thanks

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

Re: Hide "Add New Tab" button always

Post by Sasha - Tracker Dev Team »

Hello Simon,

Well, now I know the reason why the Root.Count is always zero - you simply take the wrong MainFrm:

Code: Select all

Dim layout As PDFXEdit.IUIX_Layout = Me.docPreview.Inst.MainFrm(0).View.DocViewsArea.Panes.Layout
Try this instead:

Code: Select all

Dim layout As PDFXEdit.IUIX_Layout = Me.docPreview.Inst.MainFrm(1).View.DocViewsArea.Panes.Layout
Also, the conversion itself does not need a control available - only the IPXV_Inst with the needed plugins, so basically, if you don't want to show the conversion results or something then you should only use the operations and the IPXC_Document as their output that you can later open in the main control.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Hide "Add New Tab" button always

Post by lidds »

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

Re: Hide "Add New Tab" button always

Post by Sasha - Tracker Dev Team »

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