home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!decwrl!netcomsv!dolphin!yamanote!gordie
- From: gordie@yamanote.dolphin.com (Gordie Freedman)
- Subject: Re: Simple TextDidChange Question
- Message-ID: <1992Nov11.071013.8200@dolphin.com>
- Sender: gordie@dolphin.com
- Reply-To: gordie@yamanote.dolphin.com
- Organization: Dolphin Software
- References: <1992Nov10.172039.23956@jarvis.csri.toronto.edu>
- Date: Wed, 11 Nov 1992 07:10:13 GMT
- Lines: 60
-
- In article <1992Nov10.172039.23956@jarvis.csri.toronto.edu>
- west@turing.toronto.edu (Tom West) writes:
- > Hopefully as simple question:
- >
- > The situation:
- >
- > I have a Text object that implements TextDidChange. It sets the window
- > "changed" (i.e. close box correctly marked and so forth). When I save
- > the window, I set the window to "unchanged". Unfortunately, I never see
- > TextDidChange again because TextDidChange fires only the first time that
- > the text changed after the Text is made first responder.
- >
- > The Question:
- >
- > Short of selecting some arbitrary window and then selecting my text
- > is there some way of resetting the TextDidChange flag so that it will
- > once again? How is this generally solved?
- >
- > Once again, I'll be happy to forward any answer I receive.
- >
- > --
- >
- > Tom West
- >
- > west@turing.toronto.edu or "Children of the Blood"
- > tomwest@gpu.utcs.utoronto.ca or -Michelle Sagara
- > west@hsa.on.ca
-
- I had the same problem. It seems that textDidChange means changed since
- the window got focus, so if you keep focus you won't get the message
- again. Instead, I used textDidGetKeys and textWillConvert. Put them in and
- run the program in gdb, with breakpionts in the methods so you can see
- exactly why and when they get invoked (read the TeXT doc too).
-
- Unfortunately, this doesn't get things like color changes, underline,
- setting alignment ... I subclassed the text object anyway, and overrode
- methods for things like:
-
- - alignSelRight:sender
- {
- [super alignSelRight:sender];
- [delegate textDidGetKeys:self isEmpty:([self textLength] == 0)];
- return self;
- }
-
- - underline:sender
- {
- [super underline:sender];
- [delegate textDidGetKeys:self isEmpty:([self textLength] == 0)];
- return self;
- }
-
- Note these are not in the delegate but in my object subclassed from text.
- And there's more (alignSelCenter|Left, and for changing colors, and maybe
- even for fonts), but you'll surely find them.
-
- --
- Gordie Freedman gordie@yamanote.dolphin.com -> NextMail encouraged
- (Disclaimer: Opinions expressed are my own and represent no one else.)
-
-