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




Reply via email to