Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails SOLVED
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.
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.
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hi Support,
I cannot reproduce this in EU Editor as there's some coding required. Can be reproduced in FullDemo.
Here's what I have:
I'm loading a document in pxvControl using IPXV_MainFrame.OpenDocFrom + specifying PermF_All - PermF_Copy for SecPermMask in pOpenParams. This all works fine and opens the document in "read-only" mode - so any editing command items are disabled in the UI (main menu and main command bar).
At some moment I would make a call to: "pxvControl.Doc.CoreDoc.SetRestrictedPermissions(0)" - so to make editing possible.
After the above call all menu items and command items in the main menu bar should be enabled.
The issue I have is that sometimes command items on the main command bar (like cmd.tool.editContent) will stay disabled and sometimes they will properly get enabled. When they stay disabled - the corresponding menu item will correctly be enabled (I guess that's because in main menu you set command item state when selecting/opening the parent menu item).
If I switch to another document and back to the first one - main bar commands are properly refreshed / enabled.
I would say that sometimes after calling SetRestrictedPermissions - a call to refresh command item states does not get properly done from your side (your internal code).
Or in steps:
1. Load document OpenDocFrom ( PermF_All - PermF_Copy )
1.1. Document is loaded in read-only mode and all the UI elements are properly disabled.
2. Call SetRestrictedPermissions(0)
Sometimes the UI (main bar command items) is properly refreshed (so all command items are enabled), sometimes command items in main command bar stay disabled.
I was hoping I could duck-tape this by calling InstUI.CmdManager.UpdateCmdItemsByTarget(UIX_CmdItemUpdate_State, Document Frame's MainView) - but it did nothing to refresh command items and their state (to make them enabled).
Hoping the above is clear.
p.s.
Maybe to fire some kind of "e_somethingschanged" event?
-žarko
I cannot reproduce this in EU Editor as there's some coding required. Can be reproduced in FullDemo.
Here's what I have:
I'm loading a document in pxvControl using IPXV_MainFrame.OpenDocFrom + specifying PermF_All - PermF_Copy for SecPermMask in pOpenParams. This all works fine and opens the document in "read-only" mode - so any editing command items are disabled in the UI (main menu and main command bar).
At some moment I would make a call to: "pxvControl.Doc.CoreDoc.SetRestrictedPermissions(0)" - so to make editing possible.
After the above call all menu items and command items in the main menu bar should be enabled.
The issue I have is that sometimes command items on the main command bar (like cmd.tool.editContent) will stay disabled and sometimes they will properly get enabled. When they stay disabled - the corresponding menu item will correctly be enabled (I guess that's because in main menu you set command item state when selecting/opening the parent menu item).
If I switch to another document and back to the first one - main bar commands are properly refreshed / enabled.
I would say that sometimes after calling SetRestrictedPermissions - a call to refresh command item states does not get properly done from your side (your internal code).
Or in steps:
1. Load document OpenDocFrom ( PermF_All - PermF_Copy )
1.1. Document is loaded in read-only mode and all the UI elements are properly disabled.
2. Call SetRestrictedPermissions(0)
Sometimes the UI (main bar command items) is properly refreshed (so all command items are enabled), sometimes command items in main command bar stay disabled.
I was hoping I could duck-tape this by calling InstUI.CmdManager.UpdateCmdItemsByTarget(UIX_CmdItemUpdate_State, Document Frame's MainView) - but it did nothing to refresh command items and their state (to make them enabled).
Hoping the above is clear.
p.s.
Maybe to fire some kind of "e_somethingschanged" event?
-žarko
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails SOLVED
Hi Support,
I've managed to solve this by iterating over *all* IUIX_CmdPanes.IUIX_CmdLines.IUIX_CmdBars of IPXV_MainView and calling IUIX_CmdBar.UpdateItems(UIX_CmdItemUpdate_State, -1);
Not an ideal fix, but works. Still, the issue is there somewhere in your code...
-ž
I've managed to solve this by iterating over *all* IUIX_CmdPanes.IUIX_CmdLines.IUIX_CmdBars of IPXV_MainView and calling IUIX_CmdBar.UpdateItems(UIX_CmdItemUpdate_State, -1);
Not an ideal fix, but works. Still, the issue is there somewhere in your code...
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hello zarkogajic,
The iteration though all of the needed commands is the correct way to do this.
Cheers,
Alex
The iteration though all of the needed commands is the correct way to do this.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hi Alex,
Thanks, as said works but not ideal.
Why the following does not do it - as from what I (think I) know about UpdateCmdItemsByTarget - this should do it:
InstUI.CmdManager.UpdateCmdItemsByTarget(UIX_CmdItemUpdate_State, Document Frame's MainView)
?
-ž
Thanks, as said works but not ideal.
Why the following does not do it - as from what I (think I) know about UpdateCmdItemsByTarget - this should do it:
InstUI.CmdManager.UpdateCmdItemsByTarget(UIX_CmdItemUpdate_State, Document Frame's MainView)
?
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hello zarkogajic,
Not exactly - there are commands that are handled by different targets. For example this property gives you an ID of the target that handles the command:
https://sdkhelp.pdf-xchange.com/vi ... d_TargetID
Basically some of the commands are handled by the documents view, some by the bookmarks view, etc. So if you call the update for the main view target - only the commands that are handled by it will be updated.
Cheers,
Alex
Not exactly - there are commands that are handled by different targets. For example this property gives you an ID of the target that handles the command:
https://sdkhelp.pdf-xchange.com/vi ... d_TargetID
Basically some of the commands are handled by the documents view, some by the bookmarks view, etc. So if you call the update for the main view target - only the commands that are handled by it will be updated.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hi Alex,
ok, clear.
Anyhow, do we agree that something wrong is happening behind the scenes?
-ž
ok, clear.
Anyhow, do we agree that something wrong is happening behind the scenes?
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hello zarkogajic,
If you are modifying something at the Core Level, the UI won't be updated unless the needed events/updates are being done manually. So there is nothing wrong with this behavior.
Cheers,
Alex
If you are modifying something at the Core Level, the UI won't be updated unless the needed events/updates are being done manually. So there is nothing wrong with this behavior.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hi Alex,
But that's not what happens.
As described in the first post in this topic, when I do pxvControl.Doc.CoreDoc.SetRestrictedPermissions(0) - the UI sometimes updates, sometimes it does not. And there's no difference in what I do.
-žarko
But that's not what happens.
As described in the first post in this topic, when I do pxvControl.Doc.CoreDoc.SetRestrictedPermissions(0) - the UI sometimes updates, sometimes it does not. And there's no difference in what I do.
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hello zarkogajic,
That's exactly what I'm telling - the UI update can happen if some random redraw can break through. The correct way is to send events/update.
Cheers,
Alex
That's exactly what I'm telling - the UI update can happen if some random redraw can break through. The correct way is to send events/update.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hi Alex,
Ok.
Is here an even I can fire so that update happens?
I do not like this iterating code over CommandPanes/CommandLines/CommandBars.
-žarko
Ok.
Is here an even I can fire so that update happens?
I do not like this iterating code over CommandPanes/CommandLines/CommandBars.
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hello zarkogajic,
Well you can try firing e_customizeCmdLayout or e_cmdCustomization and see if it works.
Cheers,
Alex
Well you can try firing e_customizeCmdLayout or e_cmdCustomization and see if it works.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
HI Alex,
I've tried both events with nParam1=nParam2=0 for CreateNewEvent. No changes in UI. I'm passing Inst for pFrom in FireEvent
Any other idea?
-ž
I've tried both events with nParam1=nParam2=0 for CreateNewEvent. No changes in UI. I'm passing Inst for pFrom in FireEvent
Code: Select all
//kinda pseudo
IEvent evt = Inst.EventServer.CreateNewEvent(e.cmdCustomization/e.customizeCmdLayout , 0, 0);
Inst.EventServer.FireEvent(evt, Inst);
Any other idea?
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hello zarkogajic,
Not from what I know. Basically iterating trough needed command IDs (it can be all of them) via the https://sdkhelp.pdf-xchange.com/vi ... teCmdItems will do the trick.
Cheers,
Alex
Not from what I know. Basically iterating trough needed command IDs (it can be all of them) via the https://sdkhelp.pdf-xchange.com/vi ... teCmdItems will do the trick.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Hi Alex,
Yes, this seems to do it!
InstUI.CmdManager.UpdateCmdItems(UIX_CmdItemUpdate_State, 0);
Thanks. Case not only solved but closed
-ž
Yes, this seems to do it!
InstUI.CmdManager.UpdateCmdItems(UIX_CmdItemUpdate_State, 0);
Thanks. Case not only solved but closed
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Altering CoreDoc.SetRestrictedPermissions (PXC_PermsFlags) - refresh command items sometimes fails
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ