SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]  SOLVED

PDF-XChange Editor SDK for Developers

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

SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by zarkogajic »

Hi Support,

When changing the IPXC_DocSrcInfo's CustDispTitle: e.document.propsChanged with DocViewFlag_DisplayDocTitle needs to be fired for the corresponding IPXV_Document so that its Tab grabs the change and updates its display. This all works as expected.

However, I also need to set the TitlePrefix of the document's tab IUIX_LayoutItem (which is the actual tab).

It seems that your internal update, after event fired, of the IUIX_LayoutItem Title happens in "async mode" after e.document.propsChanged BUT also removes TitlePrefix value - and the tab displays only the new Title and not the TitlePrefix.

Or, in (kind of pseudo) code:

Code: Select all

    Document.CoreDoc.SrcInfo.CustDispTitle := 'my new Title';

    evt := Document.EventServer.CreateNewEvent(e.document.propsChanged, Document, DocViewFlag_DisplayDocTitle);
    Document.EventServer.FireEvent(evt, Document);
    
    //here - e.document.propsChanged can be caught in pxvControl's OnEvent
    //but the Document.ActiveView.Obj.Parent.LI.Title is still the old one
    
    //then , this line should change the tab's title prefix but does not ... so the actual Title change and TitlePrefix reset happens later
    Document.ActiveView.Obj.Parent.LI.TitlePrefix := "some prefix";    
Reading Document.ActiveView.Obj.Parent.LI.Title just before the setter for Document.ActiveView.Obj.Parent.LI.TitlePrefix returns the old value of Title and not "my new Title".

Seems that the actual change of the tab's title happens "much" after the e.document.propsChanged can be caught.

And, as stated, new Title value resets my TitlePrefix value.

So, question: how/when to catch when the tab's title actually does get changed, and TitlePrefix, reseted, so I can set back the TitlePrefix to what I need it to be?


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

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by zarkogajic »

Support?

Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by Sasha - PDF-XChange »

Hello zarkogajic,

The e_app_prefsChanged event is being fired and there the title update happens. Basically, you should obtain the IBitSet interface from the first param of the event and check whether the PXV_AppPrefsChange_Documents flag is set. If so, update the title prefix.

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

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by zarkogajic »

Hi Alex,

I've tried catching e_app_prefsChanged in PXVControl's OnEvent (event is registered for listening) - but it seems never to happen...

Btw, why would it be e_app_prefsChanged when changing document's CustDispTitle - as this is per document / not per app/instance.

-žarko
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by Sasha - PDF-XChange »

Hello zarkogajic,

In my case, I've changed the title display settings on the application's level. Can you tell how to modify our UI so that your case happens, and I can see how our native code is being called?

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

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by zarkogajic »

Hi Alex.

This can be tested in Full Demo (having document's tab displayed and having a document loaded):

Code: Select all

pdfCtl.Doc.CoreDoc.SrcInfo.CustDispTitle = "my custom title";
//need to call this so that tab is updated, if not no change in tab's title
PDFXEdit.IEvent evt = pdfCtl.Doc.EventServer.CreateNewEvent(pdfCtl.Inst.Str2ID("e.document.propsChanged", false), 0, (uint)PDFXEdit.PXC_DocumentViewFlags.DocViewFlag_DisplayDocTitle);
pdfCtl.Doc.EventServer.FireEvent(evt, pdfCtl.Doc);

//-> here you can catch e.document.propsChanged, but "pdfCtl.Doc.ActiveView.Obj.Parent.LI.Title" is still the "original" title

//Now:
//only setting LI's TitlePrefix does not update it, must also set Title (reported as an issue in some other topic)
pdfCtl.Doc.ActiveView.Obj.Parent.LI.TitlePrefix = "my prefix";
pdfCtl.Doc.ActiveView.Obj.Parent.LI.Title = "my li title";

//here -> tab's title is again "my custom title" - so TitlePrefix value is lost.

p.s.
At the moment forum search is not working (?) - so cannot locate topics where pieces of the above are discussed.

-žarko
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by Sasha - PDF-XChange »

Hello zarkogajic,

Investigated this behavior.
When you fire the e.document.propsChanged event, the timer for 250ms is being launched and then the UITitle is being updated.
Basically you can update the title afterwards by firing your timer.

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

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by zarkogajic »

Hi Alex,

Thanks. Btw, can you confirm that setting the CustDispTitle resets LayoutItem's TitlePrefix ?

-žarko
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]  SOLVED

Post by Sasha - PDF-XChange »

Hello zarkogajic,

Firing the e.document.propsChanged resets all of the UITitle.

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

Re: SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]

Post by zarkogajic »

ok, all clear, thanks :)

Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

<t>SrcInfo.CustDispTitle + Event (e.document.propsChanged, DocViewFlag_DisplayDocTitle) + IUIX_LayoutItem.Title[Prefix]<

Post by Sasha - PDF-XChange »

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