- // Don't know how to move the focus further. The application needs to tell us which actor to move the focus to
- mIsWaitingKeyboardFocusChangeCommit = true;
- Actor nextFocusableActor = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
- mIsWaitingKeyboardFocusChangeCommit = false;
+ Actor nextFocusableActor;
+
+ Toolkit::Control currentFocusControl = Toolkit::Control::DownCast(currentFocusActor);
+
+ // If the current focused actor is a control, then find the next focusable actor via the focusable properties.
+ if( currentFocusControl )
+ {
+ int actorId = -1;
+ Property::Index index = Property::INVALID_INDEX;
+ Property::Value value;
+
+ // Find property index based upon focus direction
+ switch ( direction )
+ {
+ case Toolkit::Control::KeyboardFocus::LEFT:
+ {
+ index = Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::RIGHT:
+ {
+ index = Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::UP:
+ {
+ index = Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::DOWN:
+ {
+ index = Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ default:
+ break;
+ }
+
+ // If the focusable property is set then determine next focusable actor
+ if( index != Property::INVALID_INDEX)
+ {
+ value = currentFocusActor.GetProperty( index );
+ actorId = value.Get<int>();
+
+ // If actor's id is valid then find actor form actor's id. The actor should be on the stage.
+ if( actorId != -1 )
+ {
+ if( currentFocusActor.GetParent() )
+ {
+ nextFocusableActor = currentFocusActor.GetParent().FindChildById( actorId );
+ }