There are a few methods involved in making this happen and some will vary
depending on how you want things to look like...
#takesKeyboardFocus
(should return true)
#handlesKeyboard: event
(should return true or true for specific keys required
#keyStroke: event
"Process keys navigation."
self navigationKey: event
(calls Polymorph navigation key handling)
#keyboardFocusChange: aBoolean
"The message is sent to a morph when its keyboard focus changes.
Update for focus feedback."
self focusChanged
(update focus indication rendering)
#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]
(draw keyboard focus indication using theme defaults, guess you may
omit this and just do your "selection" thing in #keyboardFocusChange:)
Hope this helps!
Regards, Gary
----- Original Message -----
From: "nullPointer" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 09, 2010 10:23 PM
Subject: [Pharo-project] Force the focus of a panel for start to listen
keypress events.
>
> Well, I decided let the optimization and threads load for later, my
> knowledge
> is poor, and see that very complicated :|
>
> Now my main problem is the navigation through cells of grid. All cells
> have
> a "value control" (currently a label) where is viewed the value data. I
> need
> when a TAB key is pressed the current cell pass to next cell.
>
> My question:
>
> -How I can "focus" morph (the cell) for begin to listen the key presses
> events? that morph is really only a PanelMorph subclass. Really I
> understand
> than need the behavior of list widgets or textboxes for that cell, force
> the
> focus of some way.
>
> Regards and thanks for the answers.
> --
> View this message in context:
> http://n4.nabble.com/Conseils-for-develop-a-grid-tp1299737p1475136.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project