return markupString;
}
+void TextInput::ShowPlaceholderText( const MarkupProcessor::StyledTextArray& stylePlaceHolderText )
+{
+ mDisplayedTextView.SetText( stylePlaceHolderText );
+ mPlaceHolderSet = true;
+ mDisplayedTextView.SetScrollPosition( Vector2( 0.0f,0.0f ) );
+}
+
void TextInput::SetPlaceholderText( const std::string& placeHolderText )
{
// Get the placeholder styled text array from the markup string.
MarkupProcessor::GetStyledTextArray( placeHolderText, mStyledPlaceHolderText, IsMarkupProcessingEnabled() );
-
if( mStyledText.empty() )
{
- // Set the placeholder text only if the styled text is empty.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
}
if( mStyledText.empty() )
{
- // If the initial text is empty, set the placeholder text.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
else
{
if( mStyledText.empty() )
{
- // Styled text is empty, so set the placeholder text.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
}
break;
if( mStyledText.empty() )
{
- // Styled text is empty, so set the placeholder text.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
else
{
mDisplayedTextView.RemoveTextFrom( mPreEditStartPosition, numberOfCharactersToReplace );
}
+
GetTextLayoutInfo();
EmitTextModified();
}
mStyledText.erase( start, end ); // erase range of characters
- // Remove text from TextView.
+ // Remove text from TextView and update place holder text if required
+ // Set the placeholder text only if the styled text is empty.
if( mStyledText.empty() )
{
- // Styled text is empty, so set the placeholder text.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
else
{
if( mStyledText.empty() )
{
- // Styled text is empty, so set the placeholder text.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
else
{
if( textToInsert.empty() && emptyTextView )
{
// No character has been added and the text-view was empty.
- // Set the placeholder text.
- mDisplayedTextView.SetText( mStyledPlaceHolderText );
- mPlaceHolderSet = true;
+ // Show the placeholder text.
+ ShowPlaceholderText( mStyledPlaceHolderText );
}
else
{