[Pharo-project] focus morph

Hilaire Fernandes hilaire.fernandes at edu.ge.ch
Wed Jun 22 10:30:57 EDT 2011


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"
> <hilaire.fernandes at edu.ge.ch>
> To: <pharo-project at lists.gforge.inria.fr>
> 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





More information about the Pharo-dev mailing list