Example #1
0
        private void ForceEditTextASCII(EditText text)
        {
            var oldText = text.Text;
            var newText = Utils.ForceASCII(oldText);

            if (oldText != newText)
            {
                var sel1 = text.SelectionStart;
                var sel2 = text.SelectionEnd;
                text.Text = newText;
                text.SetSelection(sel1, sel2);
            }
        }
Example #2
0
        private void ForceTextBoxASCII(Entry textBox)
        {
            // All of our text storage is ASCII at the moment, so enforce it right away
            // to prevent issues later on.
            var oldText = textBox.Text;
            var newText = Utils.ForceASCII(oldText);

            if (oldText != newText)
            {
                var cursorPos = textBox.Position;
                textBox.Text     = newText;
                textBox.Position = cursorPos;
            }
        }
Example #3
0
        private void ForceTextBoxASCII(TextBox textBox)
        {
            // All of our text storage is ASCII at the moment, so enforce it right away
            // to prevent issues later on.
            var oldText = textBox.Text;
            var newText = Utils.ForceASCII(oldText);

            if (oldText != newText)
            {
                var selStart = textBox.SelectionStart;
                var selLen   = textBox.SelectionLength;

                textBox.Text            = newText;
                textBox.SelectionStart  = selStart;
                textBox.SelectionLength = selLen;
            }
        }