[Cuis-dev] Be notified of edit from TextModelMorph

Hilaire Fernandes hilaire at drgeo.eu
Thu Feb 17 06:26:04 PST 2022


Hi guys,

This does the trick, I prefer to use keyStroke (up and down key), 
keyDown works with a delay, model udpated at second key down:

inputWidget scroller
         setProperty: #keyStroke:
         toValue: [:event | inputWidget scroller acceptContents].

May be a helper flag to autoUpdate the model.

Or something more general with a block, but likely, it is just one line 
to add in the user code, so not sure you need to do it. But yes, an 
autoUpdate flag will be handy enought for casual users of TextModelMorph.

Thanks

Le 17/02/2022 à 00:13, Juan Vuletich via Cuis-dev a écrit :
>> This works setting properties on TextModelMorph innerTextMorph, which 
>> is not ideal, but works if you want to avoid subclassing at all costs:
>>
>> tm := TextModelMorph withText: 'test'.
>>
>> tm innerTextMorph setProperty: #'keyDown:'
>>     toValue: [:ev | Transcript show: ev].
>>
>
> This looks like a good way to do it. Maybe we could add some helper 
> method(s) to TextModelMorph to ease it. Maybe #keyDownAction: would be 
> handy.

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220217/c2570daa/attachment-0001.htm>


More information about the Cuis-dev mailing list