Something is deleting my custom bars upon cmd.open  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

Something is deleting my custom bars upon cmd.open

Post by zarkogajic »

Hi Support,

This will sound crazy ... but after hours of trying to figure out what went wrong .. I must ask.

I have multiple MainFrames (instances of pxv_control) in my application. In each MainView.CmdPaneTop I add my custom CmdBar with commands.

Out of blue, the following started to happen: having multiple pxv_control instantiated, opening a document in one using cmd.open - after the document is open - my custom bars are gone from the other pxv_control instances.

They are not hidden - they are really gone. If I iterate over all IUIX_CmdLine/IUIX_CmdBar in MainView.CmdPaneTop - they are really not there.

If I tell you I am not the one deleting those - what wicked magic could be happening? As if somehow all (default) bars/lines in that CmdPane have been recreated (and as a result my custom ones are gone).

Is there an event I could catch when bars/lines are being removed from IUIX_CmdPane - so to try to figure out what's happening...

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

Re: Something is deleting my custom bars upon cmd.open

Post by zarkogajic »

Hi Support,

I've located and fixed the problem. One call to Lock/UnlockCmdCustomizationEvent was missing - and hiding one custom CmdBar would somehow delete all other custom bars/commands in other MainFrames.

BIG questions:

1. Why does the above happen if I do not call LockCmdCustomizationEvent ? Why are all my custom bars in other frames deleted?

2. What would be IUIX_CmdBar.LockUpdates / UnLockUpdates used for?

3. When is CmdManager.LockAllPanesUpdates required to be used?

4. When hiding/showing particular CmdItem then LockCmdCustomizationEvent does not need to be called?

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

Re: Something is deleting my custom bars upon cmd.open

Post by Vasyl-Tracker Dev Team »

It may occur because almost any change in cmdbars/cmdpanes is 'monitored' by Editor, and then automatically 'reproduced' in other instances of the same type (i.e - in other Mainframes). To avoid this automatic synchronization of toolbars - you need to enclose that changes by LockCmdCustomizationEvent/UnlockCmdCustomizationEvent. But yes, at the moment I have no idea why your custom toolbar is deleted when you hide it without locking that event. How do you hide that toolbar?

IUIX_CmdBar.LockUpdates - it locks all updates to certain toolbar until UnlockUpdates. It means that IUIX_CmdBar.Update will do nothing in that period, just will mark that toolbar was 'changed'. For example, when you need to insert/delete bunch of items to that toolbar - then is better to enclose this modification by IUIX_CmdBar.LockUpdates/UnlockUpdates. The last UnlockUpdates - will physically update the modified toolbar.

IUIX_CmdManager.LockAllPanesUpdates/UnlockAllPanesUpdates - is the way to block updates for all toolbars/panes from all windows. In case when you add/delete/toggle/change many bars at once - it is better to use this lock.

When you make just one change (add/delete/toggle one toolbar or one toolbar's item, etc) - is not necessary to use that locks.

Note: IUIX_CmdBar.LockUpdates/UnlockUpdates and IUIX_CmdManager.LockAllPanesUpdates/UnlockAllPanesUpdates are incremental.
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: Something is deleting my custom bars upon cmd.open  SOLVED

Post by zarkogajic »

Vasyl,

Thanks, all clear.

I am hiding the CmdBar via IUIX_CmdBar.Hide method.

It is the only bar in only CmdLine in CmdPaneBottom (of MainView) added by me.

If Lock/UnlockCmdCustomizationEvent is *not* used -> the bar is "hidden" but actually somehow entire CmdLine deleted - after the call to Hide no lines/bars exist any more - so Hide actually deletes (that Bar and Line) and not hides.

But, the above somehow also removes all custom added Lines/Bars even Items in default Bars.

When using Lock/UnlockCmdCustomizationEvent all works how it should.

-žarko
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Something is deleting my custom bars upon cmd.open

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply