mFocusChangedSignal(),
mFocusGroupChangedSignal(),
mFocusedActorEnterKeySignal(),
- mCurrentFocusActor( 0 ),
+ mCurrentFocusActor(),
mFocusIndicatorActor(),
mFocusGroupLoopEnabled( false ),
mIsFocusIndicatorEnabled( false ),
bool success = false;
// Check whether the actor is in the stage and is keyboard focusable.
- if( actor && actor.IsKeyboardFocusable() )
+ if( actor && actor.IsKeyboardFocusable() && actor.OnStage() )
{
if( mIsFocusIndicatorEnabled )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Focus Changed\n", __FUNCTION__, __LINE__);
// Save the current focused actor
- mCurrentFocusActor = actor.GetId();
+ mCurrentFocusActor = actor;
Toolkit::Control newlyFocusedControl = Toolkit::Control::DownCast(actor);
if( newlyFocusedControl )
Actor KeyboardFocusManager::GetCurrentFocusActor()
{
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
- return rootActor.FindChildById(mCurrentFocusActor);
+ Actor actor = mCurrentFocusActor.GetHandle();
+ if( actor && ! actor.OnStage() )
+ {
+ // If the actor has been removed from the stage, then it should not be focused
+
+ actor.Reset();
+ mCurrentFocusActor.Reset();
+ }
+ return actor;
}
Actor KeyboardFocusManager::GetCurrentFocusGroup()
}
}
- mCurrentFocusActor = 0;
+ mCurrentFocusActor.Reset();
mIsFocusIndicatorEnabled = false;
}