textfield

TextField changes in SwiftUI

偶尔善良 提交于 2019-12-01 00:14:05
I have a simple TextField that binds to the state 'location' like this, TextField("Search Location", text: $location) I want to call a function each time this field changes, something like this: TextField("Search Location", text: $location) { self.autocomplete(location) } However this doesn't work. I know that there are callbacks, onEditingChanged - however this only seems to be triggered when the field is focussed. How can I get this function to call each time the field is updated? You can create a binding with a custom closure, like this: struct ContentView: View { @State var location:

JavaFX TextField - Allow only one letter to be typed

 ̄綄美尐妖づ 提交于 2019-11-30 23:57:12
I'm trying to make a Suduko game in JavaFX but I can't figure out how to only allow one letter to be entered. Would the answer to this to be to call the textfield and do: myTextField.setOnKeyPressed(e -> { if (!myTextField.getText().length().isEmpty()) { // Somehow reject the key press? } } The above way won't work with copy pasting... or tons of other things, etc. Using key press listeners like this seems like an AWFUL idea. There must be something better? Is there a property of text fields to allow only certain characters to be inputted, or only allow certain number of characters to be

How to restrict TextField so that it can contain only one '.' character? JavaFX

谁都会走 提交于 2019-11-30 23:51:37
On the Internet, I found very useful class, using which I can restrict TextField. I encountered a problem, where my TextField can contain only one '.' character. I suspect that I can handle this by writing an appripriate regex and set it as a restriction on the instance of that class. I use the following regex: "[0-9.-]", but it allows as many dots as the user types. May I ask you to help me to configure my TextField so that no more than one '.' is allowed. import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property

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

怎甘沉沦 提交于 2019-11-30 22:05:14
问题 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 clarity of the problem 回答1: For the default font scaling, 1sp = 1dip = 1/160". A height of 11sp is about 1/15th of an inch, which is pretty tiny. This is a Lint error. You can override it -- press <Ctrl>-<1> , and the quick-fix list menu should give

Xcode: Easiest Way To Send Data From iOS TextField For Example To A Remote Database

末鹿安然 提交于 2019-11-30 20:17:03
问题 I currently have an online web hosted MySQL database with HostGator.com that currently stores user sign ups for a service of mine. Currently, the only way to store information in that database is from my online form on a website. My goal is to replicate that form on an iOS app by using textfields etc. What I need help figuring out is, how can I take the data input from the user on the iOS app, and send that information to the MySQL database. From what I found, there is no way to go from iOS

Link in input text field

纵然是瞬间 提交于 2019-11-30 20:04:38
HI All, I know this is bit strange question, but please suggest. I want to create a link on website url content in input type"text" field not any other html tag,Is it possible and if yes how. Regards & Thanks Amit Flak DiNenno This is unfortunately not possible in the way you've asked it in HTML 4 or below. Even with HTML5 which has several new INPUT TYPEs, including URL, it only does validation and has some other useful functions, but won't give you want you want. You might look for some jQuery plugins that can help you do this, most use the same principals behind Rich Text or other online

How to restrict TextField so that it can contain only one '.' character? JavaFX

梦想的初衷 提交于 2019-11-30 18:11:24
问题 On the Internet, I found very useful class, using which I can restrict TextField. I encountered a problem, where my TextField can contain only one '.' character. I suspect that I can handle this by writing an appripriate regex and set it as a restriction on the instance of that class. I use the following regex: "[0-9.-]", but it allows as many dots as the user types. May I ask you to help me to configure my TextField so that no more than one '.' is allowed. import javafx.beans.property

JavaFX: Focusing textfield programmatically

℡╲_俬逩灬. 提交于 2019-11-30 17:54:00
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) { n.setFocusTraversable(false); Now I have some textfields, checkboxes, and buttons. I would like to change the state of my input controls (textfield, checkbox,..) programatically: for example I would like to enter the textfield to edit the content programatically. So my question is: how to enter in a non-focus-traversable textfield? Because textfield.requestFocus();

HTML input field hint

房东的猫 提交于 2019-11-30 17:13:34
I want to provide the user with a hint on what he needs to enter into my text field. However, when I set the value, it does not disappear once a user clicks on the text field. How can you make it disappear? <form action="input_password.htm"> <p>Username:<br><input name="Username" value="Enter username.." type="text" size="20" maxlength="20"></p> </form> You'd need attach an onFocus event to the input field via Javascript: <input type="text" onfocus="this.value=''" value="..." ... /> With a bit of javascript <input value="Enter username.." onfocus="if (this.value == 'Enter username..') this

Listeners and reactions in Scala Swing

回眸只為那壹抹淺笑 提交于 2019-11-30 17:10:18
问题 I've done a fair bit of searching and some trial and error in eclipse, but there seems to be a gap in my understanding of listeners and reactions when writing a GUI in Scala using Swing. Does each listener get a reactions block, or do I register listeners on all components that might generate an event and react to each on in a large reactions block with case statements? Where exactly do the listeners and reaction blocks belong. Here's an abbreviated version of my GUI code: import scala.swing.