[Cuis-dev] not understanding TextModelMorph

Juan Vuletich juan at cuis.st
Thu Jun 13 13:17:01 PDT 2024


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 TextModelMorphopens displays my name. I can type into it. But it 
> does not change the value of theauthorinstance variableinbook. 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

Cheers,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240613/a61a03b9/attachment-0001.htm>


More information about the Cuis-dev mailing list