I want to get only numerical inputs how can i do it using TextField
TextField newTextField= new TextField ("Lines/Words:", "",3, TextField.NUMERIC);
You can use the TextField#setInputConstraints to limit the input.
Related
I have a project in Xcode (storyboard) and I am trying to make a search in a database in my Firestore on my 1st ViewController with a search bar (it could be a textfield as well); no results should be displayed in a tableview, instead it should feed a picker view in my 2nd viewController; after that, right above my picker view I have a textfield that display the choice of the picker view; and below that I have a label that should display the same text as the above textfield.
Very simple. Any suggestion? highly appreciated.
You would need to return the values from Firestore, getting a DocumentSnapshot and using this reference to the collection, to set the value on your textfield or other fields.
I would recommend you to take a look at the post from the Community How to sync Flutter TextField with Firestore field? that provides a full example of how to use Firestore and updating displaying fields. This example is in Flutter, which I believe should help you even in case you are not using Flutter.
Besides that, this other below question from Stack should provide you some more insights on how to achieve that.
How to fetch the data from cloud_firestore and display it in the TextField in flutter
Let me know if the information helped you!
I have got a task to write a calculator on wicket and I have faced with some problems.
How to get button value(1,2,3...-,+,/,*) handle it(multiply or divide) and output a result to text field to user? Could you help me, please.
In swing it is really easy, e.g. new JtextField.setText("Shalom world!"); How I can do the same in wicket?
Thank you
Use a TextField, or Label, to display the calculator value. The model for the component should get an object that you update on each click of a button. A quick way to do this would be to create a member variable in your class that holds your total and use a PropertyModel to get the value of the member variable. If you are using AjaxLink, you will need to add the TextField to your target on click of each button and you need setOutputMarkupId to be true.
I want that when the length of the text of a TextField is larger than the TextField's preferredWidth then the TextField should ticker. How to achieve that ?
Thank you very much
http://www.java.net/forum/topic/mobile-embedded/lwuit/how-enable-tickering-textfields
I'm trying to build a dynamically sized spark textArea which limits the possible text to its size.
E.g the textarea is set to width="300" and height="100". Now the user should only be able to enter or paste as much text as can be visible in the component. I don't want the textArea to scroll or linebreak if more text is entered.
I tried all sorts of approaches, but none with success.
Help is highly appreciated!
I encountered the same issue but no perfect solution is found. But I found a simple workaround for this issue.
Spark TextArea has a textDisplay attribute of type IEditableText. by default, a RichEditableText component is assigned to this attribute. There is a property called contentHeight in this component. I used this property to determine if the text height exceeds textArea height. So my simple solution is like this:
protected function textArea1_changeHandler(event:TextOperationEvent):void {
if (textArea1.textDisplay is RichEditableText){
if ((textArea1.textDisplay as RichEditableText).contentHeight > textArea1.height){
textArea1.maxChars = textArea1.text.length;
}
else {
textArea1.maxChars = 0;
}
}
}
Of cause, this needs to be fine tuned before using in an application. But I wanted to post the solution as soon as possible :) I will post exact logic required. But I think you can do it by your own too...
for a Spark textArea I used this on each change of text:
while (textArea.textFlow.flowComposer.numLines>textArea.heightInLines)
textArea.text = textArea.text.substr(0,textArea.text.length-1);
I want to design one form that contains TextField and ListView in J2ME. But I don't know how to create this form. It is looked like Dictionary Form. Could anybody help me to do that?
You can't really do that with the basic UI controls in MIDP.
List can't contain TextField.
I would suggest looking at LWUIT since it has better controls.
Otherwise, if you don't need to display Images in your List, then you can use a Form containing both TextField and StringItem. Unfortunately, an ItemStateListener added to the Form will probably not give you as much information as a List.
Implementing the list yourself in a CustomItem means writing quite a bit of code but is doable.
If what you need is a TextField where you enter a search String and a List that displays the search result, I suggest using a TextBox first, then a List. Separate screens are by far the quickest solution here.
Edit: you can't use swing in j2me. what you can do is have just a textfield in a form, then add/remove StringItems to/from the Form when the user changes the content of the TextField. You should be able to rely on ItemStateListener to tell you when the textfield content changes.