Yes, your suggestion works out of the box, but it is sad it is too much
magic looking like. I had a note on the collaborative pharo book.

Is there some magic to set focus on mouse clic? Or is it just about
handling mouse clic and set the focus?

Thanks

Hilaire

Le 22/06/2011 16:30, Hilaire Fernandes a écrit :
> Thanks, great info!
> 
> 
> Le 22/06/2011 16:24, Gary Chambers a écrit :
>> Additionally, you need to respond true to #handlesKeyboard:
>> Otherwise the Morphic event dispatcher won't send a keystroke.
>>
>> Mostly though you'll need to implement:
>>
>> keyboardFocusChange: aBoolean
>> "The message is sent to a morph when its keyboard focus changes.
>> Update for focus feedback."
>>
>> self focusChanged
>>
>>
>> +and
>>
>> drawSubmorphsOn: aCanvas
>> "Display submorphs back to front.
>> Draw the focus here since we are using inset bounds
>> for the focus rectangle."
>>
>> super drawSubmorphsOn: aCanvas.
>> self hasKeyboardFocus ifTrue: [self drawKeyboardFocusOn: aCanvas]
>>
>>
>> +and
>>
>> keyStroke: event
>> "Process keys navigation and space to toggle."
>>
>> (self navigationKey: event) ifTrue: [^self].
>>        "your key handlers here if any..."
>>
>> in order to have the focus drawn and handle tab/shift-tab navigation
>> between morphs.
>>
>> Sorry it is less than simple, just the way Morphic is (unless we
>> refactor focus stuff to be potentially applicable to all morphs).
>>
>> Regards, Gary
>>
>> ----- Original Message ----- From: "Hilaire Fernandes"
>> <[email protected]>
>> To: <[email protected]>
>> Sent: Wednesday, June 22, 2011 2:56 PM
>> Subject: [Pharo-project] focus morph
>>
>>
>>> Hello,
>>>
>>> In a panel morph I have a collection of morph, I want the focus features
>>> on these morphes.
>>>
>>> morphs of the collection respond true to the takesKeyboardFocus message
>>> but so far it does not help.
>>>
>>>
>>> What is the usual way to do that?
>>>
>>>
>>> -- 
>>> Education 0.2 -- http://blog.ofset.org/hilaire
>>>
>>>
>>
>>
>>
> 
> 


-- 
Education 0.2 -- http://blog.ofset.org/hilaire


Reply via email to