Thread View: comp.sys.next.programmer
2 messages
2 total messages
Started by Tom West
Tue, 10 Nov 1992 22:20
Simple TextDidChange Question
Author: Tom West
Date: Tue, 10 Nov 1992 22:20
Date: Tue, 10 Nov 1992 22:20
25 lines
1171 bytes
1171 bytes
Hopefully as simple question:
The situation:
I have a Text object that implements TextDidChange. It sets the window to
"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 again,
is there some way of resetting the TextDidChange flag so that it will fire
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
Re: Simple TextDidChange Question
Author: Gordie Freedman
Date: Wed, 11 Nov 1992 07:10
Date: Wed, 11 Nov 1992 07:10
59 lines
2625 bytes
2625 bytes
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.)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads