PluggalbeTextMorph eats cr
Ken G. Brown
kbrown at tnc.com
Fri Sep 21 22:37:05 UTC 2001
<>
> > 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,
If I put self halt. in sendTextToControl:, when I just do the cr without any
text, it does not get hit but does as soon as I have a char to send too.
> there are three reasonable possibilities:
>
> 1) #sendTextToControl: is not invoked.
This is the case when there is no text in the pane, it 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.
I believe you are right about this, I am adding it in the method.
> 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.
Can't do here since it doesn't get here on an empty string.
> 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.
I will be happy if I can find where it decides not to send my
sendTextToControl: when the text is empty, then I could test there and add
it. Perhaps somewhere in acceptContents?
> So, I'll wait until you explicitly ask for that :)
Please oh please!
Thx
Ken
> Cheers,
> Bijan Parsia.
>
>
More information about the Squeak-dev
mailing list
|