Hi,
Say I want to show the Bookmarks pane from code, I can use: "Inst.ExecUICmd2(IDFOR("cmd.view.bookmarks"))".
Executed once bookmark pane will get displayed, executed again, it will get hidden.
I want to get if the pane is visible or hidden then show if hidden, hide if visible...
It seems I can read the state (PXV_Control.Doc.ActiveView.BookmarksView.Obj.Visible) but am not sure how to set it.
Also, I see I can use
PXV_Control.Doc.ActiveView.Panes.Show/Hide(IPXV_View)
but how do I go from string "bookmarksView" to the IPXV_View?
-žarko
(Bookmark) Panes: show/hide/check visible SOLVED
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
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.
-
zarkogajic
- User
- Posts: 1523
- Joined: Thu Sep 05, 2019 12:35 pm
-
zarkogajic
- User
- Posts: 1523
- Joined: Thu Sep 05, 2019 12:35 pm
Re: (Bookmark) Panes: show/hide/check visible
Hi devs,
To answer my question (with an additional question at the end):
Bookmarks view is accessible only when a document is loaded - so you cannot show/hide without at least one document - this is how it works in the EndUser Editor.
According this: viewtopic.php?t=31474#p127467
To show/hide/change title/do other stuff with the bookmarksview (and other document-panes like PageThumbsView, AttachmentsView, LinksView and the rest) you can get the IUIX_LayoutItem, like:
Then you can do things like
Btw, if you have multiple documents or even multiple MainFrames (that is multiple pxv_Controls) you might want to go for the below setting - as hiding/showing the pane for one document will not also hide/show for the other(s):
Now, the tricky part is how to get notified when the view is set to be visible or hidden. For this you have to implement a custom IUIX_ObjImpl handler as in here: viewtopic.php?f=66&t=26067&hilit=Pane+show#p101658
Now, since one can access the BookmarksView object only when there's a document, the Obj sent to custom event handler is PXV_Control.Doc.ActiveView.BookmarksView.Obj - and this view is tied to that document.
So, when to instantiate the custom handler? My approach is in "e.document.viewingStarted" - as this is when you have the document and when you have an ActiveView - and (seems so far) this event fires only once per document.
Inside IUIX_ObjImpl's OnEvent implementation you go with "if pEvent.Code = e_Visible" and the Obj gives you the info you need (set visible, etc).
The thing is that if you load another document - the event does not get fired - as the BookmarksView.Obj for the second document is not the same as for the document you are custom event handling.
For the second document (and any other loaded) one needs to instantiate another instance of IUIX_ObjImpl for that document's BookmarkView.Obj - when "e.document.viewingStarted" as stated above.
Can this be confirmed by support-devs?
-žarko
To answer my question (with an additional question at the end):
Bookmarks view is accessible only when a document is loaded - so you cannot show/hide without at least one document - this is how it works in the EndUser Editor.
According this: viewtopic.php?t=31474#p127467
To show/hide/change title/do other stuff with the bookmarksview (and other document-panes like PageThumbsView, AttachmentsView, LinksView and the rest) you can get the IUIX_LayoutItem, like:
Code: Select all
uiLItem : IUIX_LayoutItem;
...
uiLItem := PXV_Control.Doc.ActiveView.Panes.Layout.GetItem(PXV_Control.Doc.ActiveView.BookmarksView.Obj);
Code: Select all
uiLItem.Title := 'XXX';
uiLItem.Show;
uiLItem.Hide(false);
Code: Select all
Inst.Settings['Docs.AutoSyncDocPanesLayouts'].v := false;
Inst.FireAppPrefsChanged(PXV_AppPrefsChange_Documents, nil);
Now, since one can access the BookmarksView object only when there's a document, the Obj sent to custom event handler is PXV_Control.Doc.ActiveView.BookmarksView.Obj - and this view is tied to that document.
So, when to instantiate the custom handler? My approach is in "e.document.viewingStarted" - as this is when you have the document and when you have an ActiveView - and (seems so far) this event fires only once per document.
Inside IUIX_ObjImpl's OnEvent implementation you go with "if pEvent.Code = e_Visible" and the Obj gives you the info you need (set visible, etc).
The thing is that if you load another document - the event does not get fired - as the BookmarksView.Obj for the second document is not the same as for the document you are custom event handling.
For the second document (and any other loaded) one needs to instantiate another instance of IUIX_ObjImpl for that document's BookmarkView.Obj - when "e.document.viewingStarted" as stated above.
Can this be confirmed by support-devs?
-žarko
-
Sasha - PDF-XChange
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: (Bookmark) Panes: show/hide/check visible SOLVED
Hello žarko,
An also yes, you will have to make an array of command handlers for each of the Bookmarks Views - then everything will work for you.
Cheers,
Alex
This would be OK.So, when to instantiate the custom handler? My approach is in "e.document.viewingStarted" - as this is when you have the document and when you have an ActiveView - and (seems so far) this event fires only once per document.
An also yes, you will have to make an array of command handlers for each of the Bookmarks Views - then everything will work for you.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ