示例#1
0
        /// <summary>
        /// Prepare the input paragraph for display.
        /// </summary>
        /// <param name="usePlaceholder">If true, will use the placeholder text. Else, will use the real input text.</param>
        /// <param name="showCaret">If true, will also add the caret text when needed. If false, will not show caret.</param>
        /// <returns>Processed text that will actually be displayed on screen.</returns>
        protected string PrepareInputTextForDisplay(bool usePlaceholder, bool showCaret)
        {
            // set caret char
            string caretShow = showCaret ? ((int)_caretAnim % 2 == 0) ? "|" : " " : string.Empty;

            // set main text when hidden with password char
            if (HideInputWithChar != null)
            {
                var hiddenVal = new string(HideInputWithChar.Value, _value.Length);
                TextParagraph.Text = hiddenVal.Insert(_caret >= 0 ? _caret : hiddenVal.Length, caretShow);
            }
            // set main text for regular text input
            else
            {
                TextParagraph.Text = _value.Insert(_caret >= 0 ? _caret : _value.Length, caretShow);
            }

            // update placeholder text
            PlaceholderParagraph.Text = _placeholderText;

            // get current paragraph and prepare to draw
            Paragraph currParagraph = usePlaceholder ? PlaceholderParagraph : TextParagraph;

            TextParagraph.UpdateDestinationRectsIfDirty();

            // get text to display
            return(currParagraph.GetProcessedText());
        }
示例#2
0
        /// <summary>
        /// Prepare the input paragraph for display.
        /// </summary>
        /// <param name="usePlaceholder">If true, will use the placeholder text. Else, will use the real input text.</param>
        /// <param name="showCaret">If true, will also add the caret text when needed. If false, will not show caret.</param>
        /// <returns>Processed text that will actually be displayed on screen.</returns>
        protected string PrepareInputTextForDisplay(bool usePlaceholder, bool showCaret)
        {
            // set main paragraph text and add caret mark if needed
            string caretShow = showCaret ? ((int)_caretAnim % 2 == 0) ? "|" : " " : string.Empty;

            TextParagraph.Text = _value.Insert(_caret >= 0 ? _caret : _value.Length, caretShow);

            // update placeholder text
            PlaceholderParagraph.Text = _placeholderText;

            // get current paragraph and prepare to draw
            Paragraph currParagraph = usePlaceholder ? PlaceholderParagraph : TextParagraph;

            TextParagraph.UpdateDestinationRectsIfDirty();

            // get text to display
            return(currParagraph.GetProcessedText());
        }
示例#3
0
        /// <summary>
        /// Prepare the input paragraph for display.
        /// </summary>
        /// <param name="usePlaceholder">If true, will use the placeholder text. Else, will use the real input text.</param>
        /// <returns>Processed text that will actually be displayed on screen.</returns>
        protected string PrepareInputTextForDisplay(bool usePlaceholder)
        {
            // set main text when hidden with password char
            if (HideInputWithChar != null)
            {
                TextParagraph.Text = new string(HideInputWithChar.Value, _value.Length);
            }
            // set main text for regular text input
            else
            {
                TextParagraph.Text = _value;
            }

            // update placeholder text
            PlaceholderParagraph.Text = _placeholderText;

            // get current paragraph and prepare to draw
            Paragraph currParagraph = usePlaceholder ? PlaceholderParagraph : TextParagraph;

            TextParagraph.UpdateDestinationRectsIfDirty();

            // get text to display
            return(currParagraph.GetProcessedText());
        }