Tab menu in multi tab mode SOLVED
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: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Tab menu in multi tab mode
Hi support,
Now that I know more about how this all works I'd like to "reopen" a topic I asked before...
So, is there a way (never mind how complex) to customize (add/remove items) or react on command items in the tab menu:
-ž
Now that I know more about how this all works I'd like to "reopen" a topic I asked before...
So, is there a way (never mind how complex) to customize (add/remove items) or react on command items in the tab menu:
-ž
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Hello zarkogajic,
Like I said before, there is no way of doing that now.
Cheers,
Alex
Like I said before, there is no way of doing that now.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
ok, thanks.
Let's hope for it ...
-ž
Let's hope for it ...
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
Hi Alex,
I think you mentioned I could display my own menu for the tab (as currently I'm hiding the default one).
So, how to display my own menu for tab (and re-use most of the default menu items) ?
-žarko
I think you mentioned I could display my own menu for the tab (as currently I'm hiding the default one).
So, how to display my own menu for tab (and re-use most of the default menu items) ?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Hello žarko,
First you will have to create an IUIX_CmdMenu by using the https://sdkhelp.pdf-xchange.com/vi ... ateCmdMenu method.
After that, you can fill it with the needed commands by using this method or one of the other 3: https://sdkhelp.pdf-xchange.com/vi ... nsertItem4
After that you will have to display that menu. For that you will have to use the https://sdkhelp.pdf-xchange.com/vi ... wPopupMenu method and pass your menu there.
In case of the Tab popup menu, you should use the "documentViewsArea" IUIX_Obj as a pSender, the LeftTop and RightBottom of the rectangle should be the point of the Current Cursor Position (screenwise coordinates) and you should specify the true value for the result returning.
If you do all of this, you should be able to replace that menu with your custom one.
Cheers,
Alex
First you will have to create an IUIX_CmdMenu by using the https://sdkhelp.pdf-xchange.com/vi ... ateCmdMenu method.
After that, you can fill it with the needed commands by using this method or one of the other 3: https://sdkhelp.pdf-xchange.com/vi ... nsertItem4
After that you will have to display that menu. For that you will have to use the https://sdkhelp.pdf-xchange.com/vi ... wPopupMenu method and pass your menu there.
In case of the Tab popup menu, you should use the "documentViewsArea" IUIX_Obj as a pSender, the LeftTop and RightBottom of the rectangle should be the point of the Current Cursor Position (screenwise coordinates) and you should specify the true value for the result returning.
If you do all of this, you should be able to replace that menu with your custom one.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
Hi Alex,
Thanks, sounds straightforward and doable
I know the tab menu is generated dynamically, and I think commands as well - so I cannot use (some of the) the same commands in my custom menu?
-žarko
Thanks, sounds straightforward and doable
I know the tab menu is generated dynamically, and I think commands as well - so I cannot use (some of the) the same commands in my custom menu?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Hello žarko,
You can use all of the needed commands from that menu - they do have their command handlers, so basically, you will just have to add the needed commands. Here's a list of all the commands that can be there in current logic:
id_cmd_duplicateTab
id_cmd_renameDoc
id_cmd_closeTab
id_cmd_closeOtherTabs
id_cmd_closeTabsToTheRight
id_cmd_closeTabsToTheLeft
id_cmd_sortAllTabsAbc
id_cmd_copyTabSrcFileName
id_cmd_openTabSrcFolder
id_cmd_reopenJustClosedDoc
id_cmd_moveTabToTrash
Cheers,
Alex
You can use all of the needed commands from that menu - they do have their command handlers, so basically, you will just have to add the needed commands. Here's a list of all the commands that can be there in current logic:
id_cmd_duplicateTab
id_cmd_renameDoc
id_cmd_closeTab
id_cmd_closeOtherTabs
id_cmd_closeTabsToTheRight
id_cmd_closeTabsToTheLeft
id_cmd_sortAllTabsAbc
id_cmd_copyTabSrcFileName
id_cmd_openTabSrcFolder
id_cmd_reopenJustClosedDoc
id_cmd_moveTabToTrash
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
Alex,
Great!
I'll "solved" the topic once I have it implemented
-žarko
Great!
I'll "solved" the topic once I have it implemented
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
Hi Alex,
Here's what I have and the popup is displaying and the result of the popup is the id of the clicked menu item's command - however nothing happens:
After the click nothing happens. I've also tried:
Further, since the CmdManager.Cmds does not have those commands registered, how can I grab the icon and use it in InsertItem4, for example? Or a more general question: obviously InsertItem4 knows about this command (or simply generates all on the fly even if such a command does not exist?!) and the command manager does not, so how can I get to IUIX_Cmd if it is not in registered commands?
Finally, if I need to do all from code (get the popup result any apply my code as action), so cannot reuse those commands, how do I get the tab (index) and the document so to know what tab/document to close, for example.
-žarko
Here's what I have and the popup is displaying and the result of the popup is the id of the clicked menu item's command - however nothing happens:
Code: Select all
cmdMenu := InstUI.CreateCmdMenu;
cmdMenuC1 := cmdMenu.InsertItem4('cmd.closeTab', 'cmd.closeTab Text', UIX_CmdItemState_Normal, nil, 'cmd.closeTab Tip', -1, 0);
cmdMenuC2 := cmdMenu.InsertItem4('cmd.openTabSrcFolder Text', 'cmd.openTabSrcFolder', UIX_CmdItemState_Normal, nil, 'cmd.openTabSrcFolder Tip', -1, 0);
//cmdHandler := cmdMenuC1.Cmd.Handler; <- there is a handler
//i := cmdMenuC1.Cmd.ID;
//i := cmdMenuC2.Cmd.ID;
retCmdID := InstUI.CmdManager.ShowPopupMenu(pSender, cmdMenu, menuRect, true, 0);
Code: Select all
//nothing happens
cmdMenuC1.Cmd.Handler.OnNotify(UIX_CmdNotify_Exec, cmdMenuC1.Cmd, nil, pSender, 0);
// error result as this command is not registered in Cmd manager
InstUI.CmdManager.ExecCmd2(retCmdID, pSender);
Finally, if I need to do all from code (get the popup result any apply my code as action), so cannot reuse those commands, how do I get the tab (index) and the document so to know what tab/document to close, for example.
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode SOLVED
Hello žarko,
What I see from code, is that the implementation of the commands is being done right after the popup is closed, meaning that if you want to use this behavior, the implementation should be done by your side.
For example, for the id_cmd_closeTab, the DocumentViewsArea.Panes.Hide(docView); code should be used.
Also, to obtain the IPXV_View from tab:
1) The IUIX_LayoutItem should be obtained from the UIX_NotifyInfo.pData (simple cast with the null check should be OK) - let's call it pTab.
2) Then the IUIX_Obj should be obtained pTab and checked whether it's a scroll container. For that we should try casting it's implementation to the IUIX_ScrollContainer interface.
3) If successful, then we should use the IUIX_ScrollContainer::Client property to get the IUIX_Obj - that should be the object of the IPXV_View.
4) Try casting the implementation of the object to the IPXV_View.
5) If needed, the IPXV_View then can be cast to the IPXV_DocumentView.
Here's how to get the object's implementation (for example the IPXV_SearchView):
Cheers,
Alex
What I see from code, is that the implementation of the commands is being done right after the popup is closed, meaning that if you want to use this behavior, the implementation should be done by your side.
For example, for the id_cmd_closeTab, the DocumentViewsArea.Panes.Hide(docView); code should be used.
Also, to obtain the IPXV_View from tab:
1) The IUIX_LayoutItem should be obtained from the UIX_NotifyInfo.pData (simple cast with the null check should be OK) - let's call it pTab.
2) Then the IUIX_Obj should be obtained pTab and checked whether it's a scroll container. For that we should try casting it's implementation to the IUIX_ScrollContainer interface.
3) If successful, then we should use the IUIX_ScrollContainer::Client property to get the IUIX_Obj - that should be the object of the IPXV_View.
4) Try casting the implementation of the object to the IPXV_View.
5) If needed, the IPXV_View then can be cast to the IPXV_DocumentView.
Here's how to get the object's implementation (for example the IPXV_SearchView):
Code: Select all
IntPtr outPtr;
view.Obj.QueryImpl(typeof(PDFXEdit.IPXV_SearchView).GUID, null, out outPtr);
PDFXEdit.IPXV_SearchView SV = (PDFXEdit.IPXV_SearchView)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(outPtr);
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
Hi Alex,
Yes! This was the missing puzzle piece: " IUIX_LayoutItem should be obtained from the UIX_NotifyInfo.pData".
Since I'm custom handling the "documentViewsArea" and looking for e_Notify in OnEvent and reacting on UIX_Notify_Layout_ShowContextMenu (not displaying the original), the only thing that I needed to do is:
- get the layoutItem,
- get the index of the layoutItem from its parent by layoutItem.Parent.GetItemIndex(layoutItem);
- get the IPXV_DocumentView from the layoutItem.Obj's parent tree
- figure out what commands I need in my menu (depending on the index of the tab) to mimic and voila:
case closed
-ž
Yes! This was the missing puzzle piece: " IUIX_LayoutItem should be obtained from the UIX_NotifyInfo.pData".
Since I'm custom handling the "documentViewsArea" and looking for e_Notify in OnEvent and reacting on UIX_Notify_Layout_ShowContextMenu (not displaying the original), the only thing that I needed to do is:
- get the layoutItem,
- get the index of the layoutItem from its parent by layoutItem.Parent.GetItemIndex(layoutItem);
- get the IPXV_DocumentView from the layoutItem.Obj's parent tree
- figure out what commands I need in my menu (depending on the index of the tab) to mimic and voila:
case closed
-ž
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Tab menu in multi tab mode
Hi Alex,
Out of curiosity: if I do layoutItem.Remove() the tab will be lost (/"closed"), but what happens with the document (/IPXV_DocumentView) that tab "hosts" (it seems the document does not get closed)?
-žarko
Out of curiosity: if I do layoutItem.Remove() the tab will be lost (/"closed"), but what happens with the document (/IPXV_DocumentView) that tab "hosts" (it seems the document does not get closed)?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Tab menu in multi tab mode
Hello žarko,
Forwarded this one to Vasyl - will reply back when he tells more.
Cheers,
Alex
Forwarded this one to Vasyl - will reply back when he tells more.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Tab menu in multi tab mode
Hi žarko.
when layoutItem represents the document-tab:
then, to close properly the document-tab and related document too - use the:
because the layoutItem.Remove() will just remove the layout item and detaches from itself the document-view and remains it visible..
HTH.
when layoutItem represents the document-tab:
Code: Select all
PDFXEdit.IPXV_Document doc = pdfCtl.Doc;
PDFXEdit.IPXV_DocumentView docView = doc.ActiveView;
PDFXEdit.IUIX_LayoutItem layoutItem = docView.Obj.Parent.LI;
Code: Select all
layoutItem.Hide()
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.