Disable context menu on tab
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.
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.
-
- User
- Posts: 127
- Joined: Fri Jun 25, 2010 6:54 am
Disable context menu on tab
Hello,
how can i disable context menu right click on tab?
Best Regards,
edvschu
how can i disable context menu right click on tab?
Best Regards,
edvschu
-
- Site Admin
- Posts: 17949
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Disable context menu on tab
Hello edvschu,
I believe this topics shows how to handle the context menu events:
https://www.pdf-xchange.com/forum3 ... it=Context
Cheers,
Stefan
I believe this topics shows how to handle the context menu events:
https://www.pdf-xchange.com/forum3 ... it=Context
Cheers,
Stefan
-
- User
- Posts: 127
- Joined: Fri Jun 25, 2010 6:54 am
Re: Disable context menu on tab
Hello Stefan,
the post I've already discovered and tried it. But event beforeShowContextMenu is not trigger by right click on tab.
the post I've already discovered and tried it. But event beforeShowContextMenu is not trigger by right click on tab.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Disable context menu on tab
Hello edvschu,
You will need a CustomEventTarget for this one. Here's a sample that I have on this one:
https://gist.github.com/Polaringu/f3de7 ... 65695e364c
It should be initialized for DocViewArea object:
And you will have to catch a notify that a context menu will appear:
Cheers,
Alex
You will need a CustomEventTarget for this one. Here's a sample that I have on this one:
https://gist.github.com/Polaringu/f3de7 ... 65695e364c
It should be initialized for DocViewArea object:
Code: Select all
myEventTarget = new CustomEventTarget(pdfCtl.Inst.MainFrm[0].View.DocViewsArea.Obj, this);
Code: Select all
else if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_Notify)
{
IntPtr outPtr = new IntPtr(pEvent.Param1);
PDFXEdit.UIX_NotifyInfo ni = (PDFXEdit.UIX_NotifyInfo)System.Runtime.InteropServices.Marshal.PtrToStructure(outPtr, typeof(PDFXEdit.UIX_NotifyInfo));
if (ni.nCode == (int)PDFXEdit.UIX_NotifyCodes.UIX_Notify_Layout_ShowContextMenu)
{
pEvent.Handled = true;
}
}
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 127
- Joined: Fri Jun 25, 2010 6:54 am
Re: Disable context menu on tab
Thanks Alex for the perfect help.
-
- Site Admin
- Posts: 17949
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
-
- User
- Posts: 28
- Joined: Fri Feb 07, 2014 10:27 pm
Re: Disable context menu on tab
Hi All!
I seem to be having a problem with this example.
I create a new instance of CustomEventTarget:
custEventTarget = new CustomEventTarget(pdfx.Inst.MainFrm[0].View.DocViewsArea.Obj, this);
Then when this event is triggered:
public void OnEvent(PDFXEdit.IUIX_Obj pSender, PDFXEdit.IUIX_Event pEvent)
{
if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_Notify)
{
IntPtr outPtr = new IntPtr(pEvent.Param1);
PDFXEdit.UIX_NotifyInfo ni = (PDFXEdit.UIX_NotifyInfo)System.Runtime.InteropServices.Marshal.PtrToStructure(outPtr, typeof(PDFXEdit.UIX_NotifyInfo));
//if (ni.nCode == (int)PDFXEdit.UIX_NotifyCodes.UIX_Notify_Layout_ShowContextMenu)
Parent.InvokeNotifyPopupShownEvent("", "", (uint)ni.nCode);
}
}
Some codes seems to be coming through. However, "UIX_Notify_Layout_ShowContextMenu" is definitely not one of them. Any ideas?
I'm trying to prevent the default context menus from showing so that I may show my own. Thanks for your time!
I seem to be having a problem with this example.
I create a new instance of CustomEventTarget:
custEventTarget = new CustomEventTarget(pdfx.Inst.MainFrm[0].View.DocViewsArea.Obj, this);
Then when this event is triggered:
public void OnEvent(PDFXEdit.IUIX_Obj pSender, PDFXEdit.IUIX_Event pEvent)
{
if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_Notify)
{
IntPtr outPtr = new IntPtr(pEvent.Param1);
PDFXEdit.UIX_NotifyInfo ni = (PDFXEdit.UIX_NotifyInfo)System.Runtime.InteropServices.Marshal.PtrToStructure(outPtr, typeof(PDFXEdit.UIX_NotifyInfo));
//if (ni.nCode == (int)PDFXEdit.UIX_NotifyCodes.UIX_Notify_Layout_ShowContextMenu)
Parent.InvokeNotifyPopupShownEvent("", "", (uint)ni.nCode);
}
}
Some codes seems to be coming through. However, "UIX_Notify_Layout_ShowContextMenu" is definitely not one of them. Any ideas?
I'm trying to prevent the default context menus from showing so that I may show my own. Thanks for your time!
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Disable context menu on tab
Hello dconner,
Please include a small sample project that illustrates this issue and the reproduction steps so we can debug it here.
Cheers,
Alex
Please include a small sample project that illustrates this issue and the reproduction steps so we can debug it here.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 28
- Joined: Fri Feb 07, 2014 10:27 pm
Re: Disable context menu
I managed to accomplish the task using the "OnEventMonitor" without creating a "CustomEventTarget".
Now I am using the ParentId to identify the context menu:
Code: Select all
public void OnEventMonitor(IUIX_Obj pTarget, IUIX_Event pEvent)
{
if (pEvent.Code == (uint)PDFXEdit.UIX_EventCodes.e_Notify)
{
IntPtr outPtr = new IntPtr(pEvent.Param1);
if (!pTarget.IsInvalid && pTarget.Windowed)
{
PDFXEdit.UIX_NotifyInfo ni = (PDFXEdit.UIX_NotifyInfo)System.Runtime.InteropServices.Marshal.PtrToStructure(outPtr, typeof(PDFXEdit.UIX_NotifyInfo));
if (ni.nCode == (int)PDFXEdit.UIX_NotifyCodes.UIX_Notify_PopupShowed)
{
var handle = ni.pFrom.WndHandle;
string txt = ni.pFrom.Text;
string cname = "";
uint parentHandle = pTarget.WndHandle;
int parentId = pTarget.get_ID();
if (ni.pFrom.ThemeClass != null) cname = ni.pFrom.ThemeClass.ID;
var res = pdfctrl.InvokeNotifyPopupShownEvent(txt, cname, handle, parentHandle, parentId);
if (res)
{
ni.pFrom.VisibleCondition = false;
tagRECT tg = new tagRECT();
tg.top = 0;
tg.left = 0;
tg.right = -1;
tg.bottom = -1;
ni.pFrom.set_Rect(ref tg);
}
}
pEvent.Handled = true;
return;
}
}
}
Code: Select all
public class PopupHandler
{
public static bool ProcessBeforePopupShownEvent(uint PopupWindowHandle, uint PopupWindowParentHandle, int PopupWindowParentId)
{
if (PopupWindowParentId != 0)
{
if (PopupWindowHandle != 0)
{
//main form context menu
if (PopupWindowParentId == 24)
{
return true;
}
//thumbnails context menu
if (PopupWindowParentId == 25)
{
return true;
}
//bookmarks context menu
if (PopupWindowParentId == 26)
{
return true;
}
}
}
return false;
}
}
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Disable context menu on tab
Hello dconner,
If that is working for you then great
Cheers,
Alex
If that is working for you then great
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ