Morphic Data Entry

Doug Way dway at mat.net
Thu Jun 10 05:09:19 UTC 1999


> On Tue, 8 Jun 99 16:25:37 +1000 Neal Nelson <neal_nelson at primus.com.au>
> wrote:
> >If anyone could explain to me how I can generate entry fields in
Morphic,
> >I'd be more grateful. I'm stumped on my current project until I can
entry
> >forms working.

By entry field I assume you mean a text area which is limited to a single
line?  (i.e. you cannot insert return characters in the field)  This is
probably the common definition of an "entry field"... this type of widget
gets a lot of use in modern UI's.

If so, you may want to look at PluggableTextMorph>>acceptOnCR:.  Setting
this to true has the effect of limiting the entry field to one line.
(Plus hitting return to accept is more convenient than cmd-s in this
case.)

For an example, the upper left field of the Selector Browser in Morphic
works this way.

Of course, a scrollbar is totally unnecessary for a one-line entry field,
so what you *really* probably want is something like the
NonScrollingPluggableText widget in the upper left corner of BobsBrowser
(see http://www.charm.net/~arning/ ).  This widget is probably useful
enough to add to the base image, I'd say... (and it's only 3 methods...) 
maybe renamed to something simpler like TextEntry.

- Doug Way
  EAI/Transom Technogies, Ann Arbor, MI
  dway at eai.com, dway at mat.net
  http://www.transom.com


On Tue, 8 Jun 1999, Bob Arning wrote:
>
>
> Hi Neal,
>
> If you want to use TextMorph, two very useful methods are
> #contentsWrapped: and #extent:. The example below creates a fixed-width
> entry field in a morphic world:
>
>       tm _ TextMorph new.
>       tm contentsWrapped: ''; extent: 100 at 20. "this is the important
stuff"
>       (border _ AlignmentMorph newRow) "this just makes the TextMorph
> easier to see"
>               position: 200 at 200;
>               borderWidth: 1;
>               borderColor: Color black;
>               hResizing: #shrinkWrap;
>               vResizing: #shrinkWrap;
>               addMorph: tm.
>       World addMorph: border.
>
> Further decisions to make include:
>
> 1. Whether and how to limit the characters entered. You may want to
> create a subclass of TextMorph that provides additional behavior that
> many data-entry applications require (max characters, specific
> characters, formatting, etc).
>
> 2. What do do if the number of characters entered exceeds the allotted
> space. The TextMorph in the example above simply expands to add more
> rows of characters. If this is not desirable, you may want to look
> instead at PluggableTextMorph which adds a scrollbar.
>
> Cheers,
> Bob





More information about the Squeak-dev mailing list