[Cuis-dev] not understanding TextModelMorph

Mark Volkmann r.mark.volkmann at gmail.com
Thu Jun 13 13:42:37 PDT 2024


On Thu, Jun 13, 2024 at 3:17 PM Juan Vuletich <juan at cuis.st> wrote:

> On 6/13/2024 5:02 PM, Mark Volkmann via Cuis-dev wrote:
>
> Here's a simple example.
>
> VBook is a class I created with instance variables author and title. It
> has the instance methods author, author:, title, and title:. Here are two
> of them that I generated by right-clicking the class in a System Browser
> and selecting "create inst var accessors".
>
> author
>     ^ author
>
> author: anObject
>     author := anObject
>
> I ran this code in a Workspace:
>
> book := VBook new author: 'R. Mark Volkmann'; title: 'htmx'.
> tm := TextModelMorph
>     textProvider: book
>     textGetter: #author
>     textSetter: #author.
> tm openInWorld
>
> The TextModelMorph opens displays my name. I can type into it. But it
> does not change the value of the author instance variable in book. Isn't
> it supposed to do that?
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
>
> You were close. Spot the differences with:
>
> book := VBook new author: 'R. Mark Volkmann'; title: 'htmx'; yourself.
> tm := TextModelMorph
>     textProvider: book
>     textGetter: #author
>     textSetter: #author:.
> tm openInWorld
>

Yes, I forgot the "yourself" part. Thanks for catching that. But it still
doesn't work. I can change the value in the TextModelMorph and the value of
the author instance variable in the book object does not change.

-- 
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240613/16023da4/attachment.htm>


More information about the Cuis-dev mailing list