Questions tagged [textfield]

A text field (or text box) is a user-interface control allowing the user to input text into a program.

A typical text field is a rectangle, often with a border. It can be either single-line or multi-line. In addition to typing, text fields allow for a variety of other activities, such as text selection (cut, copy, paste).

This GIF ("File:Textbox2.gif" on Wikimedia Commons) depicts a text field with text being entered:

A text field with the word 'Wikipedia' being typed in

4965 questions
22
votes
2 answers

Why is didSet called twice on the TextField binding in SwiftUI?

I have a very basic view that only shows a TextField: View struct ContentView: View { @StateObject var viewModel = ViewModel() var body: some View { TextField("Enter a string...", text: $viewModel.string) } } The…
Mischa
  • 15,816
  • 8
  • 59
  • 117
22
votes
4 answers

onChange TextField move cursor to start in flutter

I try to check input with onChange method in TextField but after replacing text with TextEditingController cursor move to start of TextField. This problem occurs only on the Android platform. Code TextField( controller:…
Saman
  • 2,506
  • 4
  • 22
  • 41
22
votes
2 answers

JavaFX: Focusing textfield programmatically

I wrote an application with JavaFX which will only be usable with keyboard's arrows. So I prevented MouseEvent on Scene's stage, and I "listen" to KeyEvents. I also switched off focusability of all nodes : for(Node n : children) { …
PacDroid
  • 541
  • 1
  • 7
  • 22
21
votes
2 answers

SwiftUI textfield height didn't change

I have a simple TextField and set height and some other properties but the issue is textfield height didn't change, bellow is my code struct LoginView: View { @State private var email = "" @State private var password = "" var body:…
Drashti Javiya
  • 519
  • 1
  • 3
  • 14
21
votes
4 answers

Jasper Reports - align dynamic text fields and their labels horizontally

I'm using Jasper report 5.2, iReport 5.2 and exporting the report in RTF and PDF formats. In my report I want to add few text fields along with their (static text)labels aligned horizontally like Name: $F{name} Age: …
Ali
  • 7,810
  • 12
  • 42
  • 65
20
votes
5 answers

Select all text of TextField in Jetpack Compose

I'm using TextField component in Jetpack Compose. How to select all text when it receive focus?
any_ktokolwiek
  • 201
  • 2
  • 3
20
votes
4 answers

How can I remove Textfield focus when I press return or click outside Textfield? (SwiftUI, MacOS)

How can I remove Textfield focus when I press return or click outside Textfield? Note that this is SwiftUI on MacOS. If I do this: import SwiftUI struct ContentView: View { @State var field1: String = "This is the Text Field View" var body:…
Cortado-J
  • 2,035
  • 2
  • 20
  • 32
20
votes
6 answers

Django TextField and CharField is stripping spaces and blank lines

I just researched my "bug" and it turned out to be a new feature in Django 1.9 that CharFields strip spaces by default : https://docs.djangoproject.com/en/1.9/ref/forms/fields/#django.forms.CharField.strip The same seams to apply to text fields…
Andy
  • 726
  • 2
  • 6
  • 15
20
votes
3 answers

Why android gives warning on using size smaller than 12sp?

Well, I am developing app for 7 inch tablet, more specially for nexus 7, and in the XML layout file, i get warning Avoid using sizes smaller than 12sp: 11sp if i set the size of any textField to less than 12sp ? I am adding screen shots for more…
Muhammad Irfan
  • 1,447
  • 4
  • 26
  • 56
19
votes
4 answers

how to change TextField cursor color in flutter

I'm using TextField widget in AppBar() there is one problem , as you can see I cannot set cursor color when textfield focused usually, textfield cursor blinks when it focused. I set cursor color property , every color property in appbar,…
SILENMUS
  • 709
  • 1
  • 10
  • 25
19
votes
6 answers

Flutter: How to hide TextField text pointer (cursor) when use initial value text (Android)

Use case: Messaging app you edit your message: keyboard, blinking cursor and initial text appears but pointer (cursor) is not But on Flutter when you use initial text (or via textController) there are always pointer(cursor) which is not…
Philip Dolenko
  • 618
  • 1
  • 6
  • 12
19
votes
10 answers

How to move to next TextField in SwiftUI?

Using Swift5.1.2, iOS13.2, Xcode-11.2, Having several TextFields in a Stackview, I would like to move to the next TextField as soon as the user types x-amount of characters into the first TextField. With this link, I achieve to recognise when a…
iKK
  • 6,394
  • 10
  • 58
  • 131
19
votes
5 answers

how to get selected text from uitextfield in iphone?

I am working on Text to speech application in iPhone, in which have a text field that takes input, i want user to select some portion of text from text field and my application will convert that selected text into speech. my problem is how would i…
iCoder86
  • 1,874
  • 6
  • 26
  • 46
18
votes
1 answer

Jetpack Compose align input text in TextField

I would like to achieve similar behaviour with TextField from Jetpack Compose like from old school XML layout:
18
votes
3 answers

How to prefix country code in Textfield using Jetpack Compose

I want my Textfield to be prefixed with a country code (+91), which can't be changed by the user. How do I achieve this?