[brailleblaster] Re: How can I test whether a StyledText has changed?

  • From: "John J. Boyer" <john@xxxxxxxxxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Fri, 10 Jun 2011 10:28:05 -0500

Well, we will need a key listener in any case to handle things like 
hotkeys. StyledText has a method for adding such a listener. It could 
also check for any keys except arrow and other movement keys and set a 
textChanged boolean variable if it detects any.

John

On Fri, Jun 10, 2011 at 03:41:50PM +0100, Michael Whapples wrote:
> I can think of a number of ways of achieving what you ask, but I don't know 
> which is seen to be the best option.
> 
> 1. Keep a copy of what is written to the file in memory, on closing compare 
> this to what would be written if the document were to be saved.
> 2. You might be able to listen for events which indicate the document has 
> changed and then set a boolean variable to true to indicate document changed.
> 
> There may be others but those are the ones which first come to mind.
> 
> The other thing to remember is that the styled text control doesn't know when 
> you last saved its contents (the responsibility for saving clearly should not 
> be anywhere near styled text control) and therefore you will not find 
> anything in StyledText which will tell you the answer.
> 
> Michael Whapples
> On 10 Jun 2011, at 15:26, John J. Boyer wrote:
> 
> > Perhaps Susan knows the answer, since she haslooked at the StyledText so 
> > much. When the user indicated that a document is to be closed, how can I 
> > tel if the content of either of the views has changed? Then I would 
> > prompt the user with the usual close dialog box.
> > 
> > Thanks,
> > John
> > 
> > -- 
> > John J. Boyer; President, Chief Software Developer
> > Abilitiessoft, Inc.
> > http://www.abilitiessoft.com
> > Madison, Wisconsin USA
> > Developing software for people with disabilities
> > 
> > 
> 

-- 
John J. Boyer, Executive Director
GodTouches Digital Ministry, Inc.
http://www.godtouches.org
Madison, Wisconsin, USA
Peace, Love, Service


Other related posts: