Problem with TextFieldMorph
Ned Konz
ned at bike-nomad.com
Tue Jul 22 02:27:17 UTC 2003
On Monday 21 July 2003 06:39 pm, Vincent Foley wrote:
> > What created that text? It has some weird combination of CR and
> > CRLF line endings, as well as a stray ^L (formfeed) character or
> > two...
>
> I don't know, I just did fileOut. Looks okay in all browsers I
> use.
Did you change the concreteStream to CrLfFileStream in one of your
images?
> > If you use a plain PluggableTextMorph you won't have this
> > problem. Or you could use a TextMorph and then use #acceptOnCR:
> > and #crAction:.
> >
> > You can say:
> >
> > ptm := PluggableTextMorph on: self text: #getSomething accept:
> > #setSomething:.
> > ptm acceptOnCR: true.
>
> I'm not quite sure I understand what I should put in the text: and
> accept: messages. text: is what the default text should be I
> guess, but I don't know what accept: does.
The text: and accept: arguments are names of messages that are
understood by your model class (the on: argument).
So given this example:
ptm := PluggableTextMorph on: fred text: #getSomething accept:
#setSomething:.
ptm acceptOnCR: true.
- fred should understand both #getSomething and #setSomething:
- #getSomething will be called when the PTM needs to get the text
- #setSomething: will be called when someone has hit CR or Cmd-S
- if fred wants to change what is displayed, it should go:
self changed: #getSomething
which will cause the PTM to do the equivalent of:
self contents: (fred getSomething)
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|