Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » CanClose? Mechanism to prompt user to save edits
Re: CanClose? Mechanism to prompt user to save edits [message #34801 is a reply to message #34793] Tue, 13 December 2011 01:15 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 527
Registered: March 2007
Contributor

I am sorry. The post was from long ago, I actually changed TabCtrl to TabBarCtrl to allow closing individual TabPages. Your samples are very interesting; the serialization part in particular is something I knew was useful but never have a chance to study.

Anyways, I figured out the thing I was looking for should be CancelClose gate of TabBar (parent of TabBarCtrl), hook up the following code fixed my problem, quite decently IMHO Smile


bool MyMain::TabCancelClose(Value key)
{
     return !myTabBarCtrlInstance.FindCtrl(key)->Accept();
} 




Each Complex Ctrl that's to be hosted in a Tab page can individually decide its Accept() logic. For example, my example code above will query user to see if he/she wants to save/discard/cancel when there are modifications, and takes action accordingly.


My only remaining question was, for the TabBar libary developers, should the above logic be built in, as it should the very purpose of Accept() in Ctrl's designers intention? Sorry I don't know enough to judge, just raising a question.


TabBar has CancelCloseSome and similar gates, I am not sure if they are of any interests. For my purpose, the above is exactly what I wanted.

Thanks again to Wolfgang and Sender Ghost.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TheIDE refactoring and multiple packages build support?
Next Topic: mySql - how to use - what is needed?
Goto Forum:
  


Current Time: Tue May 07 00:04:02 CEST 2024

Total time taken to generate the page: 0.02793 seconds