I’ve found a partial hack:
whenEdited: aBlock
"Set a block to perform when the text wasEddited & the widget entered
hasUnacceptedEdits mode"
hasUnacceptedEdits whenChangedDo: [ :val |
val ifTrue: aBlock value ]
So now before the text is accepted I can block some other widgets
Uko
> On 24 Jul 2016, at 14:17, Nicolai Hess <[email protected]> wrote:
>
>
>
> 2016-07-24 13:45 GMT+02:00 Yuriy Tymchuk <[email protected]
> <mailto:[email protected]>>:
> There is #pendingText to access it, finally found that. Now I want to detect
> when someone starts typing and do actions (like disable something until the
> text is accepted). There is whenTextChanged: but it’s not that useful because
> it checks if the accepted text has changed. Is there a way to check if
> pendingCode has changed? Or if the model is entering “hasUnacceptedEdits”?
>
> No :(
>
> I don't think this is possible.
> You could turn autoAccept to true and listen for set a whenTextChanged block,
> but of course, you can not display "unaccepted" text anymore, because all
> text is accepted.
>
> Uko
>
>> On 24 Jul 2016, at 12:48, Yuriy Tymchuk <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Cool. Thank you Nicolai. While we are on this, is there an example of how to
>> display the parsing/compilation error as is done in playground?
>>
>> Uko
>>
>>
>>> On 24 Jul 2016, at 11:37, Nicolai Hess <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>
>>>
>>>
>>> 2016-07-24 11:35 GMT+02:00 Nicolai Hess <[email protected]
>>> <mailto:[email protected]>>:
>>>
>>>
>>> 2016-07-24 11:14 GMT+02:00 Yuriy Tymchuk <[email protected]
>>> <mailto:[email protected]>>:
>>> Hi,
>>>
>>> at some moment I wrote a super angry comment about Spec. But as there is a
>>> big effort put into documentation & improving the framework I’ve decided to
>>> give it another try.
>>>
>>> And guess what, after 10 min I ran into yet one more problem. I was
>>> expecting that it will be tough to have a custom styling for code, but no
>>> it’s much simpler: how do I get a text from text model? I type something
>>> in, sent #getText to the model => nothing. I expect that the problem is
>>> that the text is not accepted… Why in the first place a basic text model
>>> needs this “accept” stuff? What if I have just a dialog where someone types
>>> something and submits it? I don’t need accepts with orange corners for that.
>>>
>>> textmodel autoAccept: true.
>>>
>>>
>>> I think that you’ve got the idea. I just want to build a simple UI and it
>>> looks like it’s easier to do it with Morphic…
>>>
>>> Cheers.
>>> Uko
>>>
>>>
>>> But I agree, it is not *that* obvious and I think the behavior even changed
>>> as we replaced the PluggableTextMorph with Rubric ones - (maybe?)
>>>
>>> Anyway, maybe we need a way to distinguish between
>>> - get visible text (view get text?)
>>> and
>>> - get accepted text (model get text?)
>>>
>>> nicolai
>>>
>>
>
>