Hi Support,
How do I let the user close the altered ipxv_document without the message box asking the user to save changes (or no or cancel) being displayed.
I can catch the e.document.beforeClose and in it I can set pEvent.Handled to true and provide a non zero Result -> this stops the action from being executed - i.e. cancels the closing action (so document remains open).
I need a way to allow closing the document without asking the user about saving changes.
I guess once the e.document.beforeClose is executed, your internal code looks for IPXC_DocSrcInfo.IsDirty and (if it is) you call the "do you want to save changes..." message dialog. So if I could somehow "fool you" and set IsDirty = false the doc will close without any questions asked
-žarko
Allow closing document without asking to save changes ("override" IsDirty) 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: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
-
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Allow closing document without asking to save changes ("override" IsDirty)
You may try to close document silently using the e.document.beforeClose + pEvent.Handled=true and with the direct doc.Close(0) call inside your handler...
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.
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.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Allow closing document without asking to save changes ("override" IsDirty) SOLVED
Hi Vasyl,
Thanks.
This is actually what I am doing at the moment (though I need to "postpone" closing until events are processed)
I was hoping there's a "better" approach
-žarko
Thanks.
This is actually what I am doing at the moment (though I need to "postpone" closing until events are processed)
I was hoping there's a "better" approach
-žarko
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Allow closing document without asking to save changes ("override" IsDirty)
Hi (future readers)
Well, there is a better way
(ipxv) Document.SetModified(false, Document.ModificationLevel)
This will mark the document as not modified (even if it is) and it will be closed without asking the user to save changes.
-žarko
Well, there is a better way
(ipxv) Document.SetModified(false, Document.ModificationLevel)
This will mark the document as not modified (even if it is) and it will be closed without asking the user to save changes.
-žarko
-
- Site Admin
- Posts: 17949
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Allow closing document without asking to save changes ("override" IsDirty)
Hello zarkogajic,
Thanks for posting the above! Indeed it might be useful for others as well in the future!
Please be careful with this flag though!
Kind regards,
Stefan
Thanks for posting the above! Indeed it might be useful for others as well in the future!
Please be careful with this flag though!
Kind regards,
Stefan
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Allow closing document without asking to save changes ("override" IsDirty)
Hi Stefan,
"Be careful"
Can you provide more info ?
p.s.
Of course, I will not use that for any other purpose.
-žarko
"Be careful"
Can you provide more info ?
p.s.
Of course, I will not use that for any other purpose.
-žarko
-
- Site Admin
- Posts: 17949
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Allow closing document without asking to save changes ("override" IsDirty)
Hello zarkogajic,
I mean - to not inadvertently supress that flag in cases where it could result in the users losing data
Kind regards,
Stefan
I mean - to not inadvertently supress that flag in cases where it could result in the users losing data
Kind regards,
Stefan
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Allow closing document without asking to save changes ("override" IsDirty)
Hi Stefan
Users are overrated
-ž
Users are overrated
-ž
-
- Site Admin
- Posts: 17949
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London