op.openDoc with progress bar

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

op.openDoc with progress bar

Post by zarkogajic »

Hi Support,

Is there a way to display the progress bar when opening a core document via op.openDoc?

I've tried specifying Inst.DefaultProgressMon for the "Progress" option and also true for "SubProgress" - but no progress is being displayed - only the mouse pointer goes into "hourglass" mode while the document opened (or converted if not PDF).

When executing the operation I'm using "0" for OpExecFlags (so OpExecFlag_NoUI/OpExecFlag_NoProgress are *not* set)

I must use op.openDoc as it allows me to then use the resulting IPXC_Document with MainFrame's.OpenDocFrom to be able to open the same document two times (in two different MainFrames - 2 instances of the pxvControl).

The progress bar does nicely display if I use MainFrame's.OpenDocFrom(IAFS_Name) - but cannot use that due to the above need.

I cannot use IPXC_Inst.OpenDocumentFrom as I do not want to create my own IPXC_DocAuthCallback - and there's no default one I could use (so if a doc has a password - I want "your" standard dialog - and op.openDoc does that)

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

Re: op.openDoc with progress bar

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

The progress should be displayed by default. Are you calling the operation via the AsyncDoAndWaitForFinish method?

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

Re: op.openDoc with progress bar

Post by zarkogajic »

Hi Alex,

No, standard call.

Doing this:

Code: Select all

//kinda pseudo code
op := Inst.CreateOp(op.openDoc);
op.Params.Root["Input"].v = IAFS_Name;
options = op.Params.Root["Options"];
options["NativeOnly"].v := false;

op.Do(0);
The core document get's returned by op.Params.Root["Output"], but no progress dialog.

I've also tried adding:

options["Progress"].v = Inst.DefaultProgressMon;
options["SubProgress"].v = true;

But no change.

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

Re: op.openDoc with progress bar

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Do() won't show the progress bar - it's being called in main thread. You should use the method that I advised earlier.

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

Re: op.openDoc with progress bar

Post by zarkogajic »

Hi Alex,

Hm, confused I am :)

I am calling this in the main thread.

You are saying that AsyncDoAndWaitForFinish is how it should be called if I want the progress bar?

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

Re: op.openDoc with progress bar

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Yes. Then the operation will be executed in the separate thread, thus the progress will be shown.

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

Re: op.openDoc with progress bar

Post by zarkogajic »

Ok thanks, will try and report back if issues.

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

op.openDoc with progress bar

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: op.openDoc with progress bar

Post by zarkogajic »

Hi Alex,

As you suggested, the standard progress does show when op.openDoc is executed via AsyncDo or AsyncDoAndWaitForFinish.

Now: I'm puzzled with the "SubProgress" and "Progress" entries in the "Options" dictionary. What are those used for? SubProgress of what (parent progress)?

If I assign my own IProgressMon implementation (so not the Inst.DefaultProgressMon nor the CreateStdRangeProgressMon) - I'm receiving access violations...

Note that by default the op.openDoc uses the DefaultProgressMon since the Operation is executed via AsyncDo.

I'm opening non-PDF documents and they are first open then converted. The opening part displays the indeterminate default progress bar and when the conversion is running the default progress bar does have pos/duration.

My idea was to "inject" into the process via SubProgress - and basically wanted to see what that will do ...



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

Re: op.openDoc with progress bar

Post by zarkogajic »

Hi Support,

Ping?

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

Re: op.openDoc with progress bar

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Code: Select all

{ L"SubProgress",			dt_Bool,		0,					_N(false),					&g_NamedBool }, // set to to 'true' to keep current progress title, IProgressMon::Start/Stop not be called
And from what I see, the "Progress" node is not being used at all in the Do() method of operation.

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

Re: op.openDoc with progress bar

Post by zarkogajic »

Hi Alex,

If not being used then anything passed to it - should not result in AVs, correct (but if I do pass something for Progress - I receive AVs)?

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

Re: op.openDoc with progress bar

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Just checked this - if I pass the null value - then AV happens (should not be from my perspective - notified the appropriate developer about this one). But if I pass the DefaultProgressMon for example - no AV is there.

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

Re: op.openDoc with progress bar

Post by zarkogajic »

Hi Alex,

When op.openDoc is executed via AsyncDo[AndWaitForFinish] - it will already use the DefaultProrgressMon - so it makes no sense to use DefaultProrgressMon for "Progress".

So, in the case of AsyncDo - I am wondering what would the "Progress/SubProgress" be used for?

If I set "SubProgress" to true and set a custom implementation of IProgressMon to "Progress" - AV happens.

p.s.
Note that I am still on v.352 where only some IOperations have the Progress parameter (like op.openDoc) - while you might be testing on 353 where you said (https://forum.pdf-xchange.com/viewtopic.php?f=66&t=35666#p148300) that all Ioperations will have the Progress parameter - so maybe it is now handled differently...

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

Re: op.openDoc with progress bar

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Not all of them - only those that were using the IProgressMon interface inside of them. All I did was add a CAB Dictionary that will allow the operation to use the custom progress implementation - not just the get_ProgressMon one. If the operation was not using the progress inside, then no Progress CAB node will be present whatsoever.
In case of the op.openDoc operation - the Progress node is not being used by the operation at all, so basically even if you pass something there - it won't take any effect.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply