cmd.bookmarksView.pages.extract dialog default values  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
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

Hello!

I'm calling this command "cmd.bookmarksView.pages.extract" to extract selected bookmark pages .

In the dialog that pops up, we need to change some default values, so users dont need to change them later.

I found some code on the forum for CropPages, and adapted that code to create this class:

Code: Select all

    public partial class ExtractPagesEventMonitor : IUIX_EventMonitor
    {
        private int m_nID = 0;
        public ExtractPagesEventMonitor(int nID)
        {
            m_nID = nID;
        }

        public void OnEventMonitor(IUIX_Obj pTarget, IUIX_Event pEvent)
        {
            if (pEvent.Code == (uint)UIX_EventCodes.e_ShowModal)
            {
                IntPtr outPtr;
                pTarget.QueryImpl(typeof(IUIX_Dialog).GUID, null, out outPtr);
                IUIX_Dialog dlg = (IUIX_Dialog)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(outPtr);
                if (dlg == null)
                    return;

                if (dlg.ID != m_nID)
                    return;

                //dlg.CheckItem("RangeCtl.Current", 1, true);
                //dlg.CheckItem("crop.Redaction", 1, true);
            }
        }
    }


And then I created the code for calling the dialog:

Code: Select all

                    ExtractPagesEventMonitor extractPages = new ExtractPagesEventMonitor(pdfCtl.Inst.Str2ID(""));
                    uiInst.CurrentThreadCtx.RegisterEventMonitor(extractPages);
                    pdfCtl.Inst.ExecUICmd2("cmd.bookmarksView.pages.extract");
                    uiInst.CurrentThreadCtx.UnregisterEventMonitor(extractPages);

I now need to know what to put here:

Code: Select all

 ExtractPagesEventMonitor extractPages = new ExtractPagesEventMonitor(pdfCtl.Inst.Str2ID("WHAT GOES HERE"));
And:

Code: Select all

WHAT HOES HERE?
//dlg.CheckItem("RangeCtl.Current", 1, true);
//dlg.CheckItem("crop.Redaction", 1, true);
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: cmd.bookmarksView.pages.extract dialog default values

Post by Sasha - Tracker Dev Team »

Hello jusWest,

Here is that dialog's xml:

Code: Select all

<dialog id="DlgExtractPages" title="$$$.DlgExtractPages" width="438" height="491" font="Tahoma" fontSize="8.25" foreground="1" scrollable="true" defItem="btn.ok" contextHelp="false">
	<fixedArea size="40"/>
	<layers>
		<layer id="SaveAs"/>
	</layers>
	<items>
		<group x="8" y="8" width="410" height="125" id="RangeCtl.GroupBox" text="$$$.RangeCtl.GroupBox"/>
		<infoBtn x="289" y="51" width="16" height="16" id="RangeCtl.ArrayTip" tabstop="false" style="#00000100" text="$$$.RangeCtl.ArrayTip" buddy="RangeCtl.Array"/>
		<radio x="17" y="38" width="195" height="15" id="RangeCtl.All" style="#00000002" text="$$$.RangeCtl.All" newGroup="false" drawTextFlags="#00000100"/>
		<radio x="188" y="38" width="219" height="15" id="RangeCtl.Array" style="#00000002" text="$$$.RangeCtl.Array" newGroup="false" drawTextFlags="#00000100"/>
		<radio x="17" y="60" width="195" height="15" id="RangeCtl.Current" style="#00000002" text="$$$.RangeCtl.Current" newGroup="false" drawTextFlags="#00000100"/>
		<radio x="17" y="81" width="75" height="20" id="RangeCtl.Exact" style="#00000002" text="$$$.RangeCtl.Exact" newGroup="false" drawTextFlags="#00000100"/>
		<infoBtn x="265" y="60" width="16" height="16" id="RangeCtl.ExactEditTip" tabstop="false" style="#00000100" text="$$$.RangeCtl.ExactEditTip" buddy="RangeCtl.ExactEdit"/>
		<edit x="97" y="79" width="210" height="20" id="RangeCtl.ExactEdit" style="#00000002"/>
		<label x="312" y="82" width="105" height="15" id="RangeCtl.Total" text="$$$.PageRangesTotalPages" drawTextFlags="#00001000"/>
		<label x="18" y="108" width="75" height="15" id="RangeCtl.Filter" text="$$$.RangeCtl.Filter" drawTextFlags="#00000104"/>
		<combo x="97" y="105" width="210" height="20" id="RangeCtl.FilterEdit" style="#00000002"/>
		<group x="8" y="138" width="410" height="130" id="dep.g.options" text="$$$.dip.g.options"/>
		<label x="9" y="172" width="84" height="15" id="dep.l.optComment" text="$$$.dip.l.optComment" drawTextFlags="#00000504"/>
		<combo x="97" y="169" width="210" height="20" id="dep.cb.optComment" style="#00000002"/>
		<label x="9" y="197" width="84" height="15" id="dep.l.optWidget" text="$$$.dip.l.optWidget" drawTextFlags="#00000504"/>
		<combo x="97" y="194" width="210" height="20" id="dep.cb.optWidget" style="#00000002"/>
		<label x="9" y="222" width="84" height="15" id="dep.l.optBookmark" text="$$$.dip.l.optBookmark" drawTextFlags="#00000504"/>
		<combo x="97" y="219" width="210" height="20" id="dep.cb.optBookmark" style="#00000002"/>
		<check x="97" y="246" width="312" height="15" id="dep.ch.deletePages" style="#00000002" text="$$$.dep.ch.deletePages" drawTextFlags="#00000100"/>
		<group x="8" y="273" width="410" height="163" id="dep.g.saveExtract" text="$$$.dep.g.saveExtract.title"/>
		<label x="23" y="305" width="70" height="15" id="dep.l.saveExtract.type" text="$$$.dep.l.saveExtract.type" drawTextFlags="#00000504"/>
		<combo x="97" y="302" width="210" height="20" id="dep.cb.saveExtract.type" style="#00000002"/>
		<label x="17" y="327" width="392" height="15" id="dep.l.fileName" layer="SaveAs" text="$$$.dep.l.fileName" drawTextFlags="#00000100"/>
		<edit x="17" y="344" width="352" height="20" id="dep.eFileName" style="#00000002" layer="SaveAs"/>
		<button x="374" y="344" width="35" height="20" id="btn.Macros" style="#00040002" layer="SaveAs" tooltip="$$$.btn.Macros" icon="ico.btn.macro"/>
		<label x="17" y="370" width="392" height="15" id="dep.l.folder" layer="SaveAs" text="$$$.dep.l.folder" drawTextFlags="#00000100"/>
		<edit x="17" y="387" width="352" height="20" id="dep.eFolder" style="#00000002" layer="SaveAs"/>
		<button x="374" y="387" width="35" height="20" id="btn.browse" style="#00000002" layer="SaveAs" tooltip="$$$.btn.browse" icon="ico.folders.explorer"/>
		<check x="17" y="414" width="390" height="15" id="dep.ch.OpenFolder" style="#00000002" layer="SaveAs" text="$$$.dep.ch.OpenFolder" drawTextFlags="#00000100"/>
		<button x="225" y="8" width="100" height="24" id="btn.ok" style="#00000002" fixed="true" text="$$$.btn.ok"/>
		<button x="330" y="8" width="100" height="24" id="btn.cancel" style="#00000002" fixed="true" text="$$$.btn.cancel"/>
	</items>
</dialog>
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

great, thank you :)
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

another query trying to set the values for the following edit field:

Filename:

Code: Select all


dlg.SetItemCueText("dep.eFileName",  _fileName);


Is this the correct way to set the value?

It does noe work for me...
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: cmd.bookmarksView.pages.extract dialog default values

Post by Sasha - Tracker Dev Team »

Hello jusWest,

The Cue text is the text that is displayed in grey when no real text is entered.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

ok, so how do I replace this:

Code: Select all


%[FileName]_%[Page]

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

Re: cmd.bookmarksView.pages.extract dialog default values

Post by Sasha - Tracker Dev Team »

Hello jusWest,

First, let's try setting the text of that item - via the SetItemText method and see whether it works.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

when I do this:

Code: Select all


dlg.SetItemText("dep.eFileName", "Test text");

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

Re: cmd.bookmarksView.pages.extract dialog default values

Post by Sasha - Tracker Dev Team »

Hello jusWest,

Wow that's odd, can you please make me a small project that I can investigate to recreate this behavior?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

Here is a small project that replicates the error, at least for me.

just change the pdf path, its in the debug folder.

CTRL-B for bookmarks, and activate a bookmark and press button
Attachments
testexport.zip
(723.9 KiB) Downloaded 50 times
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

have you had the time to look at this?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: cmd.bookmarksView.pages.extract dialog default values

Post by Sasha - Tracker Dev Team »

Hello jusWest,

We'll be holding a release in a couple of days, so I will tend to this after we have deployed it.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

any updates?
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

Hope you have time to look at this soon, this is something that is holding us back at the moment.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: cmd.bookmarksView.pages.extract dialog default values  SOLVED

Post by Sasha - Tracker Dev Team »

Hello jusWest,

I've investigated this one - there was an infinite cycle inside - if you add pEvent.Handled = true; at the end, everything will work OK.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: cmd.bookmarksView.pages.extract dialog default values

Post by jusWest »

Thank you, that solved the issue :)
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: cmd.bookmarksView.pages.extract dialog default values

Post by Sasha - Tracker Dev Team »

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