React on cmd.closeAll 's Cancel button  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: 1523
Joined: Thu Sep 05, 2019 12:35 pm

React on cmd.closeAll 's Cancel button

Post by zarkogajic »

Hi support,

Having the pxv control on a form, a few documents open, some edited (but not saved).

When attempting to close the form, I'm executing cmd.closeAll - so that "Do you want to save changes ..." is displayed to the user (if needed)

How to catch the Cancel button? - as I will cancel closing of the parent form then:

image.png

Edit:
I've tried registering event monitor (custom IUIX_EventMonitor) and looking up pEvent.Param1 when pTarget.ID = 'std:MsgBox' and pEvent.Code = e_EndModal, but the value is not UIX_Cancel when the Cancel button is clicked.

-žarko
You do not have the required permissions to view the files attached to this post.
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: React on cmd.closeAll 's Cancel button

Post by Sasha - PDF-XChange »

Hello žarko,

And what is the value exactly? it should be one of the UIX_MsgBoxResult items.

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

Re: React on cmd.closeAll 's Cancel button

Post by zarkogajic »

Hi Alex,

In decimal:

7497 for Cancel
7498 for Yes
7499 for No
7506 for YesToAll
...


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

Re: React on cmd.closeAll 's Cancel button

Post by Sasha - PDF-XChange »

Hello žarko,

If you do https://sdkhelp.pdf-xchange.com/vi ... nst_ID2Str method on those values you will see the correspondent command ID's. Note that you should store the ID value converted from the string value for comparison. The numeric IDs will vary from release to release.

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

Re: React on cmd.closeAll 's Cancel button

Post by zarkogajic »

Hi Alex,

Hm .. I do not think this applies here.

The UIX_OK is hardcoded to 1, UIX_Cancel is to 2, and so on.

I'm using the same IUIX_EventMonitor implementation for another msg:box:
viewtopic.php?f=66&t=33502&p=138415&hil ... ox#p138420
and the pEvent.Param1 = UIX_Yes does return true when "Yes" is clicked.

Meaning that pEvent.Param1 is set to the hardcoded value of UIX_Yes.

I would say that the dialog displayed for cmd.closeAll assigns different values to pEvent.Param1, "shifted" in a way.

...

I just checked and the pEvent.Param1 when used in Inst.ID2Str returns "btn.cancel" - but it should not work in that way, right? pEvent.Param1 should be the modal result (UIX_MsgBoxResult) not the button name, or?

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

Re: React on cmd.closeAll 's Cancel button

Post by Sasha - PDF-XChange »

Hello žarko,

If the style is customized then the string IDs can be applied - differs from dialog to dialog. Basically here you should look for the btn.close result and it will work for you.

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

Re: React on cmd.closeAll 's Cancel button  SOLVED

Post by zarkogajic »

Hi Alex,

Ok, so cannot presume pEvent.Param1 will always be UIX_MsgBoxResult for std:MsgBox / e_EndModal.

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

Re: React on cmd.closeAll 's Cancel button

Post by Sasha - PDF-XChange »

Hello žarko,

Yup - there are some message box dialogs created other way.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ