GridPanel cell editing of type 'textfield' - editor

I'm using a GridPanel with the 'CellEditing' plugin.
My editor cell is of type 'textfield'.
I have 2 questions:
I would like to change the background color of empty cells so that it would be easier to see where there are missing values.
When double clicking a cell, I would like to format the text of the textfield. How do I get to the textfield object?
Thank you,
Dana

You might give the textfield an id property.
field: {
id: 'myId',
...
}
Access the field with
var objTextfield = Ext.getCmp('myId');
About the color, you must add or overwrite the CSS. You can set a config property 'cls' to a custom css class. See here: http://docs.sencha.com/ext-js/4-0/#/api/Ext.form.field.Text-cfg-cls

Related

Vaadin 23 change text color for TextField component

In case of error, I need to change the text of TextField to var(--lumo-error-text-color)
I tried the following:
textField.getStyle().set("color", "var(--lumo-error-text-color)");
but it doesn't work. How to properly change the text color of TextField component?
That does work just fine for me. However, assuming you want all TextFields to have red text when they're invalid, that really would be more appropriate to handle in CSS: Just add the following block to your styles.css:
vaadin-text-field[invalid]::part(input-field) {
color: var(--lumo-error-text-color);
}
Or, if you want that across all text input fields, skip the element name:
[invalid]::part(input-field) {
color: var(--lumo-error-text-color);
}
Since the text field is slotted, I don't believe you can set it's color property inline. You can add/remove a class name and use the method suggested above. Just have one class set the text to error color and the other class set it back to the regular color.

Array item completion in a UITextView

I'm trying to accomplish an autocomplete of my own for matching array items while typing. So, I already have the logic done for matching what's being typed with what's in the array, but my question is related to displaying the proposed correction in the UITextView like this screenshot
I was trying by splitting the text in the textview and replacing the last word into attributed strings, but that makes the proposed correction part of the actual contents. Any ideas of how this is accomplished in this app?
What you currently do is good , when you set the text of the textView to attributed string make bool flag say it's name is textEdited = true with a string part that the user types say it's name userStr , when textView change method is triggered check that bool and according to it make the search if it's true proceed search with userStr if it's not proceed search with whole textView text , don't forget to make textEdited= false after every zero suggested result
Edit: regarding the cursor put a label under the textfield with the same font as the textView and make it's background darkGray , also make background of the textview transparent and every attributed string assign it to the label so plus part of the label will be shown and cursor will be as it is in the textView

iOS, textView half editable

I need help in string formatting in iOS UITextView. I have a textView, for now it`s editable. Now I want to add a few strings. they should be like header and user must be able to type only under it, and when he press ENTER or DELETE line sting should change their position, so at the end it should look like
Header 1(with color not editable)
/* user can type here
*/
Header 2 (with color not editable)
/* user can type here
*/
I think i need to use delegate and attributed string or something,
but I can`t figure it out. HELP please
The best way to achieve this is to make two labels and two text views on top of a scroll view. like
The heights of two text views can by dynamic depending on the text length. And in this case you can avoid endless IF conditions as you would need to put everything in a single Text view.
The advantage of this approach is the label text format will be very easy to set, you can simply set the attributed string in the storyboard.

How to make text field like this in swift?

I want to make this kind of text field in my application. Could you guys suggest how to create a text field like the ones shown in this picture?
What you're showing in the picture is table view cells, not simply text fields. Do you want table view cells that look like that? You want table view cells if your view controller is a UITableViewController. You can easily create a nib file (cmd-n, iOS User Interface, Empty, name and save it), drag out a Table view cell from the asset library, and then drag in the label and text field (see below) into the cell.
If you don't have a UITableViewController, you could just put a UILabel (for the 'Apple ID' or 'Required' part) in your view controller's view in interface builder and then add a regular text field, write its placeholder in the Attributes Inspector, and then choose the 'Border Style' (again, in the right Utilities panel in Xcode) on the far left, the one that looks like dashed lines (this is 'no border')
Use UITextBorderStyleLine from UITextBorderStyle enum
ObjC
typedef enum {
UITextBorderStyleNone,
UITextBorderStyleLine,
UITextBorderStyleBezel,
UITextBorderStyleRoundedRect
} UITextBorderStyle;
Swift
enum UITextBorderStyle : Int {
case None
case Line
case Bezel
case RoundedRect
}
Edit:
The first image was different from the new one. So, the picture shows that It's a table view(as you can see there's header for each section) that the first section contains two text fields. The two text fields' border style is UITextBorderStyleNone.
Use Eureka! It's an open source library available on Github - https://github.com/EurekaCommunity
It's really useful for creating form-based table views like the one you've described above.

Xcode: Text Field to String

I'm new to Xcode and trying to do something easy.
But unfortunately, I couldn't find an easy way to do so.
My question might be (laughably) easy but I'm seriously stuck right now.
In Xcode, there is an object in the object library called "Text Field".
In this text field, words can be entered. I want to push a button and save the written words not a string, which I can then display as a label.
Help would be really appreciated.
Thanks in advance!
The "Text Field" UI element in the object library represents an instance of a UITextField. If you look at the documentation, a text field has a text property - a String that contains the current textual content of the text field. Similarly, UILabel has a text property. So you want to take the text field's text, and assign it to the label's text.
Assuming you have an outlet to your text field in the storyboard and an outlet/variable referencing the label you want to set the text of, in your button's action method, you might do something like this:
#IBAction func buttonPressed(button: UIButton) {
myLabel.text = myTextField.text
}

Resources