home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / next / programm / 7142 < prev    next >
Encoding:
Text File  |  1992-11-10  |  2.5 KB  |  73 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!decwrl!netcomsv!dolphin!yamanote!gordie
  3. From: gordie@yamanote.dolphin.com (Gordie Freedman)
  4. Subject: Re: Simple TextDidChange Question
  5. Message-ID: <1992Nov11.071013.8200@dolphin.com>
  6. Sender: gordie@dolphin.com
  7. Reply-To: gordie@yamanote.dolphin.com
  8. Organization: Dolphin Software
  9. References: <1992Nov10.172039.23956@jarvis.csri.toronto.edu>
  10. Date: Wed, 11 Nov 1992 07:10:13 GMT
  11. Lines: 60
  12.  
  13. In article <1992Nov10.172039.23956@jarvis.csri.toronto.edu>  
  14. west@turing.toronto.edu (Tom West) writes:
  15. > Hopefully as simple question:
  16. >   The situation:
  17. > I have a Text object that implements TextDidChange. It sets the window 
  18. > "changed" (i.e. close box correctly marked and so forth).  When I save 
  19. > the window, I set the window to "unchanged".  Unfortunately, I never see
  20. > TextDidChange again because TextDidChange fires only the first time that
  21. > the text changed after the Text is made first responder.
  22. >   The Question:
  23. >   Short of selecting some arbitrary window and then selecting my text
  24. > is there some way of resetting the TextDidChange flag so that it will
  25. > once again?  How is this generally solved?
  26. >   Once again, I'll be happy to forward any answer I receive.
  27. > -- 
  28. >     Tom West        
  29. >    west@turing.toronto.edu  or        "Children of the Blood"
  30. > tomwest@gpu.utcs.utoronto.ca  or          -Michelle Sagara
  31. >        west@hsa.on.ca
  32.  
  33. I had the same problem. It seems that textDidChange means changed since  
  34. the window got focus, so if you keep focus you won't get the message  
  35. again. Instead, I used textDidGetKeys and textWillConvert. Put them in and  
  36. run the program in gdb, with breakpionts in the methods so you can see  
  37. exactly why and when they get invoked (read the TeXT doc too).
  38.  
  39. Unfortunately, this doesn't get things like color changes, underline,  
  40. setting alignment ... I subclassed the text object anyway, and overrode  
  41. methods for things like:
  42.  
  43. - alignSelRight:sender
  44. {
  45.     [super alignSelRight:sender];
  46.     [delegate textDidGetKeys:self isEmpty:([self textLength] == 0)];
  47.     return self;
  48. }
  49.  
  50. - underline:sender
  51. {
  52.     [super underline:sender];
  53.     [delegate textDidGetKeys:self isEmpty:([self textLength] == 0)];
  54.     return self;
  55. }
  56.  
  57. Note these are not in the delegate but in my object subclassed from text.  
  58. And there's more (alignSelCenter|Left, and for changing colors, and maybe  
  59. even for fonts), but you'll surely find them.
  60.  
  61. -- 
  62. Gordie Freedman gordie@yamanote.dolphin.com   ->   NextMail encouraged
  63. (Disclaimer: Opinions expressed are my own and represent no one else.)
  64.  
  65.