BookmarksView - bookmark's state (selected / current / visible)  SOLVED

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
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

BookmarksView - bookmark's state (selected / current / visible)

Post by zarkogajic »

Hi Support,

Say I have a document with 10 pages and 10 bookmarks. Bookmark X points (GOTO action) to page X.

When I scroll through the pages, the bookmark "associated" with that page becomes "current". I do not know how you call that so I will use "current" - as in Adobe that would be "highlight current bookmark".

image.png

This is not "BookmarksView.EnsureVisibility" as even with this setting set to off - some bookmark is always displayed as "current".

[Q1] Is there a setting to disable this?

If there's no such setting (disable "highlight current bookmark"), please read on and please stay with me ...

Normally, if I click on the bookmark, the bookmark becomes selected and it's action gets executed -> "corresponding" page gets navigated to and of course the clicked/selected bookmark becomes "current".
Also, if BookmarksView.EnsureVisibility is ON, as I scroll through the pages - the "current" bookmark is ensured to be visible.

Now, what I'm doing is: handling e.document.beforeRunAction and if the action is from a bookmark I'm "canceling" it by assigning the result !=0 to pEvent and marking it as Handled - the bookmark's action does not get applied (never mind why I need it) to the actual pxvDocument. This works fine.

Now comes the interesting part: say the current pxvDocument page is 10 (and bookmark 10 is "current"). If I click on the first bookmark - as the event was canceled - page 10 is still current.

However, the BookmarksView makes bookmark_10 visible - while it should not do that - it should keep bookmark 1 visible (since clicked and selected). There was no page change in the pxvDoc.

So in steps:

"BookmarksView.EnsureVisibility" is now ENABLED.

1. make page 10 current page
2. this makes bookmark 10 being "current"
image1.png
3. scroll to bookmark one (so page 10 is still the current page) and CLICK:
image2.png
4. Action get's correctly canceled (no page change)
5. I would expect bookmark 1 to be still visible, but unfortunately:
6. bookmark 10 is made visible because of EnsureVisibility (same picture as in [2]).
image1.png

In general I want BookmarksView.EnsureVisibility but not in this case!

So, I've tried IUIX_TreeCallbacks to disable BookmarksView.EnsureVisibility just before Tree_OnItemClick and enable it again after - but not luck. This "ensuring of visibility" comes at a later stage - and I cannot figure out when does it happen.

So: [Q2]: When, after Tree_OnItemClick (so bookmark becomes selected and action gets executed) does BookmarksView.EnsureVisibility do its work?


I've also noted that if I execute bookmark's actions (all as above) when the bookmark becomes selected (so NOT via CLICK) - this does not happen!

Actually, I'm allowing only one bookmark to be selected (handling e.docSelection.changed, in IPXV_BookmSelection removing all but the last selected item), then I'm calling Inst.PerformActions for the selected bookmark. This allows to execute bookmark's actions as soon as the bookmark becomes selected - via arrow keys on the keyboard.

When the above happens (keyboard bookmark selection and perfom actions) - the BokmarksView does not jump to bookmark 10 (even BookmarksView.EnsureVisibility is ON).

I'm hoping the above is clear and that you will be able to let me know what event to handle to temporary disable BookmarksView.EnsureVisibility upon bookmark CLICK event (if there is no way to completely turn off the "highlight current bookmark" feature).

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

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

To remove that highlighter, just overload the Tree_OnDrawItem method in the TreeCallbacks and do nothing there. Then the highlighter won't be drawn.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by zarkogajic »

Hi Alex,

You sure?

I do not know what value would be "nothing", but if I return "0" (zero) then no bookmark is drawn of course (and bookmarks view appears empty).

p.s.
If I return any of: E_ABORT, E_FAIL, E_NOTIMPL everything works as before: all bookmarks and the "current" highlighter get drawn.

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

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Try returning S_FALSE (1).

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by zarkogajic »

Hi Alex,

Have already. The "current" highlighter is still drawn (and moves as I move through pages).

The Tree_OnDrawItem draws the bookmark, correct? Why would returning "nothing" only stop the highlighter to be drawn?

Also, in general I do want the highlighter of the "current" bookmark. My question was about temporarily disabling the BookmarksView.EnsureVisibility when the Tree_OnItemClick happens (because of the reasons explained in my initial post) - only if this cannot be done I would be forced to disable "highlight current bookmark" (if possible).


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

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

OK, that was wrong highlight - that one is being drawn when the search results are available.
As for your case, the OnClick logic is being done as followed:
1) The bookmark actions are being called
2) The timer is being started and then the updates take place
3) The current bookmark is being taken from the Current Pages View - thus you are being reverted to the page 10.
The timer itself is a problem as it happens some time after the code is being executed - 100ms to be exact.
Basically, you will need your timer that is greater to hack this behavior...

Unlike the tree click, the keyboard click only executes the bookmarks actions without the 2) and 3). Probably that's a small issue from our side as it probably should do that.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by zarkogajic »

Hi Alex,
OK, that was wrong highlight - that one is being drawn when the search results are available.
Hm .. I have no search active and no results therefore.

Just plain open a document with bookmarks - and the "current" highlighter is here (and moves as I scroll through pages).

Can you double check that?

Btw, can the "curent" highlighter be disabled?

Further,
3) The current bookmark is being taken from the Current Pages View - thus you are being reverted to the page 10.
I never left page 10 - it was and is the active page. What I did is clicked Bookmark_1 and canceled the action.

I guess what you are saying is: "you are being reverted to Bookmark_10 - since the timer will read the current page (10) and therefore highlight Bookmark 10 and since BookmarksView.EnsureVisibility is ON - the BookmarksView makes it visible"

If I would introduce my own timer - you are suggesting to "select" Bookmark_1 again?

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

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

The highlighter that I mentioned was about the search highlight - it's not the one that is being displayed as a Current highlight.

Yes what I'm suggesting is remember the last scroll position and set it again with your timer.

Another thing that you can try is use IUIX_Tree::LockUpdates and Unlock afterwards when your timer fires. Probably can also forbid the tree to move the selection (would be much cleaner).

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by zarkogajic »

Hi Alex,

I've tried with Lock/UnlockUpdates and my timer (in Tree_OnItemClick) with Get/SetScrollInfo - let's say it works - but there's an ugly glitch in redrawing - so cannot really use.


Anyhow, in my IUIX_ObjImpl for IPXV_BookmarksView, in OnEvent I see e_Timer is being fired.

I think there are (at least) 2 timers, by looking at pEvent.Param1 values.

Seems the timer with pEvent.Param1 = 1414873672 is responsible for marking the "current" bookmark (the other one is 1430407490).

If I set pEvent.Handled = true for it - no current bookmark highlight is drawn nor the current bookmark matches the current page - this (kind of) disables the "current bookmark" feature (but seems also the BookmarksView.EnsureVisibility - so not ideal) .

Can you confirm this? If so, can I rely on that this timerID value will not change?

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

Re: BookmarksView - bookmark's state (selected / current / visible)

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

The timer value won't change as it's hardcoded as define.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: BookmarksView - bookmark's state (selected / current / visible)  SOLVED

Post by zarkogajic »

Hi Alex,

Ok, I'll learn to live with it, so case closed.

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

BookmarksView - bookmark's state (selected / current / visible)

Post by Sasha - Tracker Dev Team »

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