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

Hide tab popup menu

Post by lidds »

When you right click on a tab when in multiple document mode a popup menu appears, as shown below. Is there a way to stop this from showing?
tabMenu.png
tabMenu.png (14.78 KiB) Viewed 3337 times
Thanks

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

Re: Hide tab popup menu

Post by Sasha - Tracker Dev Team »

Hello Simon,

For this one try to implement a custom command handler for the DocViewsArea object and intercept the right click event and mark it as handled. Here's a similar sample:
https://www.pdf-xchange.com/forum3 ... rea#p97975

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 tab popup menu

Post by lidds »

Alex,

I already have a custom command handler, see code below. However the OnEvent does not seem to fire when a right mouse click happens on the tab??

Code: Select all

Public Sub registerMouseEvent()
        Try
            myEventTarget = New CustomEventTarget(Me.docPreview.Doc.ActiveView.PagesView.Obj, Me)
        Catch ex As Exception
            Console.WriteLine("Error registering mouse events: " & ex.Message)
        End Try
    End Sub

    Partial Public Class CustomEventTarget
        Implements PDFXEdit.IUIX_ObjImpl
        Implements IDisposable

        'Here we push custom implementation of the PagesView 
        Public Sub New(obj As PDFXEdit.IUIX_Obj, parentForm As frmDocDesigner)
            Obj_ = obj
            If Obj_ IsNot Nothing Then
                Obj_.PushImpl(Me)
            End If
            Parent = parentForm
        End Sub

        Protected Overrides Sub Finalize()
            Try
                Dispose()
            Finally
                MyBase.Finalize()
            End Try
        End Sub

        'Main form - a parent that in our case holds the PDFXEdit control 
        Public Parent As frmDocDesigner = Nothing

        'Object for which we are implementing the custom event listener 
        Public Obj_ As PDFXEdit.IUIX_Obj

        'Used for single dispose control 
        Private Disposed_ As Boolean = False

        ' IUIX_ObjImpl 
        Public ReadOnly Property Obj() As PDFXEdit.IUIX_Obj
            Get
                Return Me.Obj_
            End Get
        End Property

        'Event listener that listens for all of the needed events 
        Public Sub OnEvent(pSender As PDFXEdit.IUIX_Obj, pEvent As PDFXEdit.IUIX_Event) Implements PDFXEdit.IUIX_ObjImpl.OnEvent
            Console.WriteLine("Event Code: " & pEvent.Code.ToString)
        End Sub    
Thanks

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

Re: Hide tab popup menu

Post by Sasha - Tracker Dev Team »

Hello Simon,
implement a custom command handler for the DocViewsArea object
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 tab popup menu

Post by lidds »

Alex,

I have got this working now, thanks for your help.

However, I have a scenario that I need some help with. I want to show this popup menu, but with only the "Close This Tab" option on if the document tab title matches a certain name. I am able to do all this logic, however I can't seem to figure out how to hide all the buttons apart from the "Close This Tab" option?

Thanks

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

Re: Hide tab popup menu

Post by Sasha - Tracker Dev Team »

Hello Simon,

Basically, you will have to catch the https://sdkhelp.pdf-xchange.com/vi ... ontextMenu event and then cast it:

Code: Select all

PDFXEdit.IPXV_BeforeShowContextMenuEvent evt = (PDFXEdit.IPXV_BeforeShowContextMenuEvent)e.pEvent;
Check the evt.MenuID that comes when you click on the DocViewsArea, convert the ID to string ID and use it to compare it with other menu IDs that can come through this event. If it's your menu ID then get the IUIX_CmdMenu from the event and remove/add all of the needed items.

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 tab popup menu

Post by lidds »

Hi Alex,

I know it has been awhile since you answered this post, but just getting round to sorting it. I have implemented a custom command handler for the DocViewsArea, however this is not fired when I right click on the document tab area, as shown below:
DocTab.png
DocTab.png (25.07 KiB) Viewed 2267 times
Just to recap I want to completely stop the below popup from showing:
popupToHide.png
popupToHide.png (9.36 KiB) Viewed 2267 times
Below is my code:

Code: Select all

        Try
            Dim mainFrm As IPXV_MainFrame = CType(Me.docPreview.Inst.MainFrm(PDFControlNum), IPXV_MainFrame)
            Dim view As IPXV_MainView = CType(mainFrm.View, IPXV_MainView)
            Dim docViewsArea As IPXV_DocumentViewsArea = CType(view.DocViewsArea, IPXV_DocumentViewsArea)

            myEventTabTarget = New CustomTabEventTarget(docViewsArea.Obj, Me)
        Catch ex As Exception
            Debug.WriteLine("Error registering tab events: " & ex.Message)
        End Try

Code: Select all

    Partial Public Class CustomTabEventTarget
        Implements IUIX_ObjImpl
        Implements IDisposable

        Public Parent As frmDocDesigner = Nothing
        Public Obj_ As PDFXEdit.IUIX_Obj
        Private Disposed_ As Boolean = False

        Public Sub New(ByVal obj As PDFXEdit.IUIX_Obj, ByVal parentForm As frmDocDesigner)
            Obj_ = obj
            If Obj_ IsNot Nothing Then Obj_.PushImpl(Me)
            Parent = parentForm
        End Sub

        Public Sub OnPreEvent(pSender As IUIX_Obj, pEvent As IUIX_Event) Implements IUIX_ObjImpl.OnPreEvent
        End Sub

        Public Sub OnEvent(pSender As IUIX_Obj, pEvent As IUIX_Event) Implements IUIX_ObjImpl.OnEvent
            pEvent.Handled = False

            If pEvent.Code = CInt(PDFXEdit.UIX_EventCodes.e_Notify) Then
                Dim outPtr As IntPtr = New IntPtr(pEvent.Param1)
                Dim ni As PDFXEdit.UIX_NotifyInfo = CType(System.Runtime.InteropServices.Marshal.PtrToStructure(outPtr, GetType(PDFXEdit.UIX_NotifyInfo)), PDFXEdit.UIX_NotifyInfo)

                If ni.nCode = CInt(PDFXEdit.UIX_NotifyCodes.UIX_Notify_BeforeShowPopup) Then
                    Debug.WriteLine("popup shown")
                End If
            End If
        End Sub
Thanks in advance

Simon
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Hide tab popup menu

Post by zarkogajic »

Hi Simon,

Take a look at: https://forum.pdf-xchange.com/viewtopic.php?f=66&t=29426&p=120629&hilit=UIX_Notify_Layout_ShowContextMenu#p115630

So, not "UIX_Notify_BeforeShowPopup", but "UIX_Notify_Layout_ShowContextMenu".

-žarko
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Hide tab popup menu

Post by lidds »

Hi žarko,

Thank you for the response, the problem is that the OnEvent is not fired on a right mouse click when the command handler is associated with the DocViewsArea.

It is almost like the command handler should not be linked to the DocViewArea, but something like DocViewForm etc.

Any ideas

Thanks

Simon
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Hide tab popup menu

Post by zarkogajic »

Hi Simon,

The IUIX_ObjImpl does have to be linked with IPXV_DocumentViewsArea.Obj.

You said: "OnEvent does not happen when you right click"...

If you place a beakpoint onto "pEvent.Handled = False" - does it reach it? If not, I would presume something's wrong with "Obj_.PushImpl(Me)" in your constructor.

p.s.
I have it implemented in the same way to hide that tab menu :)

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

Re: Hide tab popup menu

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Thanks for the assistance :)

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
aurimas
User
Posts: 4
Joined: Mon Mar 23, 2020 4:14 pm

Re: Hide tab popup menu

Post by aurimas »

Hey lidds,

Me and my colleague were scratching our heads trying to do the same and failed until a wild idea to replace x86 tracker dll with x64 one. From that point on everything worked. Hope this helps.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Hide tab popup menu

Post by Sasha - Tracker Dev Team »

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