PluggalbeTextMorph eats cr
Bijan Parsia
bparsia at email.unc.edu
Fri Sep 21 21:49:39 UTC 2001
On Fri, 21 Sep 2001, Ken G. Brown wrote:
> I have the following working nicely, send the stuff I type out the serial
> port:
>
> controlPane _ PluggableTextMorph
> on: self
> text: nil
> accept: #sendTextToControl:.
> controlPane acceptOnCR: true.
>
> However, if I just do a cr without any text, the cr gets eaten somewhere and
> my #sendTextToControl: does not get accessed.
Is it that it doesn't get accessed, or there's no text to send? I mean,
there are three reasonable possibilities:
1) #sendTextToControl: is not invoked.
2) It is invoked but passed #nil (unlikely)
3) It is invoked but passed the empty string.
My guess is that the latter is what's happening. I also bet that there's
no *trailing* cr when you do have text.
If you want to have a cr when there's an empty string, just modify
#sendTextToControl: to test for an empty string and do the deed.
If you want a cr *only* when an "empty" cr occurs (i.e., when an empty
textmorph gets accepted by some other means you *don't* want a cr), well,
that's more complicated.
So, I'll wait until you explicitly ask for that :)
Cheers,
Bijan Parsia.
More information about the Squeak-dev
mailing list
|