Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked  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

Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by zarkogajic »

Hi Support,

A couple of related questions here...

What magic code am I looking for if I need to know what document raised / issued the "Browse for Link Target" dialog (id::"DlgActionsGoToPage.Link") when the user clicks the "Set Link" or "Cancel" (ids::"btn.set", "btn.cancel") button on it?

Some "I know how to's": I know how to implement IUIX_EventMonitor for that dialog and get my hands on the "btn.set" button. I also know how to implement a custom IUIX_ObjImpl for it.

What I do not know is how to get to the:
[Q1] ipxv_document where the link was created (or creation canceled)?
[Q2] ipxv_document of the target document (when set link clicked)?

Further: for the moment I have a global IUIX_EventMonitor running for that dialog. I would be more happy if I could RegisterEventMonitor just before the dialog is about to get visible - [Q3] but I'm not sure what are all the commands that can trigger it (so I can wrap their execution and UnregisterEventMonitor just after)?


p.s.
I fee the "why / what I you trying to do" question might be coming, so: I have multiple Main Frames. The dialog gets issued by a document in Frame1, the target document is in Frame2. Upon action execution I need to activate / do something in Frame1 - hence I need to know what document (/frame) triggered the display of that dialog.

Yes, I might get the active document and from it the active Frame inside OnEventMonitor for e.Visible and store it somewhere - but this gets fired 3 times when the dialog is displayed (and 3 times when closing) so I'm not happy with that approach and that's a lame way to do it. I'm hoping for some more straight-forward solution. :)

-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by zarkogajic »

Hi Support,

Any idea/suggestion here?

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Started investigating this one from our inner code and found a bug when the dialog is being created. It seems that until now, the dialog's owner object was always the command object of the first active main view.
Now I changed it that the owner would be the active pages view that the rectangle was drawn upon. Thus now it would be possible to get to the dialog owner's object (IPXV_PagesView) and iterate through all of the IPXV_DocumentViews and check their IPXV_PagesView for similar handles/objects. That way you can definitely find the Frame/View that called the dialog.
The bugfix will be available from the V9.

As for the second question - the AnnotChangedEvent will be fired once the Set button is clicked. There you can get the Actions List and obtain the needed info.

As for the third question, you only can see which dialog is created ones you got it's ID. Also, the e_InitDialog is preferable here.

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by zarkogajic »

Hi Alex,

Thanks. I'll wait for V9, close the topic and reopen if needed later on :)

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

Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by Sasha - Tracker Dev Team »

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by zarkogajic »

Hi Support,
Now I changed it that the owner would be the active pages view that the rectangle was drawn upon.
Confirming it works in V9 :)

Another question:

I'm trying to "init" that dialog so that "cb.ignoreZoom" is always checked upon display (never mind if the user decided to uncheck it the "last time").

Seems like e_InitDialog is not the moment to do it, as even if I do "IUIX_Dialog(pTarget).CheckItem('cb.ignoreZoom', 1, true);" - once the dialog is displayed the checkbox is not checked.

[Q1] So, your internal code seems to uncheck it (set last known state) *after* e_InitDialog, correct?

And one more:

[Q2] Once I get my hands on that IUIX_Label (is UIX_LabelStyle_CheckBox), what are the valid values for "State" to have it checked/unchecked - I cannot find the enum for that .... (I know "0" is unckecked and "1" is checked, still I do not like hardcoding values)


p.s.
I can do the above "pre-check" in e_Visible - but just need the confirmation when e_initDialog is actually happening... as I need it for other purposes...

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Basically you can get to the tool settings via "Tools.EditLinks" and set the "GotoIgnoreZoom" to false or true (depending on what you need).

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by zarkogajic »

HI Alex,

Have a sample code line for that?

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

settings["Tools.EditLinks.GotoIgnoreZoom"] = true;

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by zarkogajic »

Hi Alex,

Aha .. IPXV_Inst related setting .. ok.

Still the question I would like to get answered:

[Q1]If I manually set the check box as checked, your internal code seems to uncheck it (set last known state) *after* e_InitDialog, correct? Or, in other words, you raise e_initDialog before the dialog is initialized by your code :) Where "initialized", from my point of view is checking/unchecking etc...


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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Well our code checks the settings while catching the e_initDialog event - the given behavior probably happens, because we catch e_initDialog after your code and set the correspondent fields after your modifications. Basically, setting the Settings will do the trick for you.

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

Re: Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked  SOLVED

Post by zarkogajic »

Hi Alex,
because we catch e_initDialog after your code and set the correspondent fields after your modifications.
That's it, thanks.

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

Get Document from "Browse for Link Target" when "Set Link" (or Cancel) clicked

Post by Sasha - Tracker Dev Team »

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