Hi,
Ok, I found a solution (inspired by OB):
-
GLMPluggableTextMorph subclasses PluggableTextMorph
-
GLMTextMorphForEditView subclasses TextMorphForEditView
-
GLMPluggableTextMorph>>textMorphClass
^ GLMTextMorphForEditView
-
GLMTextMorphForEditView>>keyStroke: anEvent
| isHandledByModel |
isHandledByModel := self editView model keystroke: anEvent from: self
editView.
isHandledByModel ifFalse: [ super keyStroke: anEvent ]
This is messy, to put it mildly :). Are there other options?
Cheers,
Doru
On 13 Jul 2011, at 13:07, Lukas Renggli wrote:
> What about using the keyDown event then?
>
> Lukas
>
> On 13 July 2011 13:05, Tudor Girba <[email protected]> wrote:
>> Yes. But as I said, the value of "self text" is already modified when it
>> gets to the #keystroke:from:
>>
>> GLMTextModel>>keystroke: anEvent from: aMorph
>> self text inspect.
>> ^ true
>>
>> So, I am stuck again :(.
>>
>> Doru
>>
>>
>>
>> On 13 Jul 2011, at 11:22, Lukas Renggli wrote:
>>
>>> And you return true, if you handled the request?
>>>
>>> On 13 July 2011 11:18, Tudor Girba <[email protected]> wrote:
>>>>
>>>> On 13 Jul 2011, at 11:08, Lukas Renggli wrote:
>>>>
>>>>>> This is what I am doing right now and it does not work:
>>>>>> (PluggableTextMorph on: textModel ...)
>>>>>> onKeyStrokeSend: #keystroke:from: to: textModel
>>>>>> ...
>>>>>
>>>>> You have to attach your handler on the text morph itself, not on the
>>>>> pluggable morph which is just a wrapper.
>>>>
>>>> This is just a helper method in PluggableTextMorph that does what you
>>>> propose:
>>>>
>>>> PluggableTextMorph>>onKeyStrokeSend: sel to: recipient
>>>> textMorph on: #keyStroke send: sel to: recipient.
>>>>
>>>> But this still does not seem to work.
>>>>
>>>> Cheers,
>>>> Doru
>>>>
>>>>
>>>>
>>>>> Lukas
>>>>>
>>>>> --
>>>>> Lukas Renggli
>>>>> www.lukas-renggli.ch
>>>>>
>>>>
>>>> --
>>>> www.tudorgirba.com
>>>>
>>>> "Speaking louder won't make the point worthier."
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>
>> --
>> www.tudorgirba.com
>>
>> "Be rather willing to give than demanding to get."
>>
>>
>>
>>
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
--
www.tudorgirba.com
"Not knowing how to do something is not an argument for how it cannot be done."