#include <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/key.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
{
- DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
+ if( impl.mController )
+ {
+ std::string text;
+ impl.mController->GetPlaceholderText( text );
+ value = text;
+ }
break;
}
case Toolkit::TextField::Property::TEXT:
{
- DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
+ if( impl.mController )
+ {
+ std::string text;
+ impl.mController->GetText( text );
+ value = text;
+ }
break;
}
case Toolkit::TextField::Property::CURSOR_IMAGE:
mController->EnableTextInput( mDecorator );
// Forward input events to controller
- mDoubleTapDetector = TapGestureDetector::New();
- mDoubleTapDetector.SetMaximumTapsRequired( 2 );
- mDoubleTapDetector.DetectedSignal().Connect( this, &TextField::OnTap );
- mDoubleTapDetector.Attach(Self());
+ EnableGestureDetection(Gesture::Tap);
+ GetTapGestureDetector().SetMaximumTapsRequired( 2 );
// Set BoundingBox to stage size if not already set.
if ( mDecorator->GetBoundingBox().IsEmpty() )
}
}
-void TextField::OnTap( Actor actor, const TapGesture& gesture )
+void TextField::OnTap( const TapGesture& gesture )
{
+ SetKeyInputFocus();
+
mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
}
+bool TextField::OnKeyEvent( const KeyEvent& event )
+{
+ if( Dali::DALI_KEY_ESCAPE == event.keyCode )
+ {
+ ClearKeyInputFocus();
+ }
+
+ return mController->KeyEvent( event );
+}
+
void TextField::RequestTextRelayout()
{
RelayoutRequest();