361 vs previous: Inst.Str2ID('DlgDocFind')  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

361 vs previous: Inst.Str2ID('DlgDocFind')

Post by zarkogajic »

Hi Support,

Another thingie seems to be working differently in v 361...

For last X versions I have my implementation of IUIX_EventMonitor to get my hands on the "Find" dialog ('DlgDocFind').

After I do all the Instance initialization (and before any IPXV stuff even gets displayed) I'm registering my event monitor:

IUIX_Inst.CurrentThreadCtx.RegisterEventMonitor(new myMonitor);

In the constructor of myMonitor I have

private int field TargetID = Inst.Str2ID('DlgDocFind', false);

Then later in OnEventMonitor I simply compare pTarget.ID with my TargetID - if not the same - exit method.

Now, this all worked fine before 361 version. From 361 the Inst.Str2ID('DlgDocFind', false) returns "0" - dialog ID does not exist yet.

Why has this changed?


p.s.
I can fix my code not to "write" TargetID in my constructor but check "pTarget.ID == Inst.Str2ID('DlgDocFind', false)" every-time in OnEventMonitor - but that's not ideal.


p.s.2
Btw, same approach for "DlgProgress" works - the ID is not 0 in construtor even though the progress dialog was "yet" never displayed.


-žarko
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: 361 vs previous: Inst.Str2ID('DlgDocFind')

Post by Vasyl-Tracker Dev Team »

Internally we have a table of unique string identifiers, associated with unique numbers. And part of the table is static, i.e. ready to use in the beginning. Other string identifiers are added by code during runtime - that is the dynamic part. And the "DlgDocFind" is adding once to this table dynamically, in a moment when you open the first doc. In previous builds this ID was added inside IPXV_Inst::Init, but currently - when the first doc is opening. Anyway, you have a very simple solution and in your code use it:

Inst.Str2ID('DlgDocFind', true)

the last parameter means 'if not exists - add this string to the table, and get the unique ID for it'.

Moreover:

Inst.Str2ID('DlgDocFind', true) == Inst.Str2ID('DlgDocFind', true)
Inst.Str2ID('DlgDocFind', true) == Inst.Str2ID('DlgDocFind', false)

- both are true-equations, while:

Inst.Str2ID('DlgDocFind', false) == Inst.Str2ID('DlgDocFind', true)

- isn't true-equation in common terms (case when 'DlgDocFind' isn't added then Str2ID(.. false) call will return 0, but second Str2ID(.. true) will return non-zero)
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: 361 vs previous: Inst.Str2ID('DlgDocFind')  SOLVED

Post by zarkogajic »

Hi Vasyl,

Thanks, all clear.

p.s.
Good to know I'm "allowed" to do Inst.Str2ID('unique_string_identifier', true) for a "known" unique string identifier.

-žarko
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

361 vs previous: Inst.Str2ID('DlgDocFind')

Post by Tracker Supp-Stefan »

:)
Post Reply