c # – Unity: The Android keyboard is only opened for the first time during successive clicks on InputField

I have one in my Unity app TMP_InputField, Clicking an input field opens the keyboard on my Android device. The problem is that this only works on the first click. When I close the keyboard after entering text and try to click the field again, the keyboard does not appear.

However, it works if I click somewhere else and then click the box again. I thought this could be due to some focus or selection states of the InputField, so I tried to fix bugs. I saw that.

    Debug.Log("Activated = " + inputField.IsActive());
    Debug.Log("Interactable = " + inputField.interactable);
    Debug.Log("InFocus = " + inputField.isFocused);
    Debug.Log("Enabled = " + inputField.enabled);
    Debug.Log("ActiveEnabled = " + inputField.isActiveAndEnabled);

I tried to log these properties of the field. When the field is created, all except inFocus are true, As soon as I click on the input field, all are true,

When I enter the text and the keyboard is closed, the inFocus field is wrong again. Now when I click on another field or just anywhere on my scene inFocus is still wrong and all other properties remain unchanged. Clicking back into the input field now opens the keyboard.

I've been around for a long time and I'm not sure what it's about. I tried to change the ControlSettings of the field in the editor, but no change.

Does anyone have any idea of ‚Äč‚Äčthis? Any pointers or help will be appreciated. Thanks a lot!

Unity: InputField created from a script via TMP_DefaultControls does not have a carat

I'm trying to script InputFields in my Unity app. Here is the code for the same.

TMP_DefaultControls.Resources uiResources = new TMP_DefaultControls.Resources();
GameObject uiInputField = TMP_DefaultControls.CreateInputField(uiResources);
uiInputField.name = "MyInput";
uiInputField.transform.SetParent(gameObject.transform);

This works fine and my field is created and works flawlessly. But the carat is missing. When I create an InputField through the editor, the carat is generated when the app runs, but not in this case. I scratched my head about it and I can not figure out why that does not work or how I can get it to work. Any suggestions? Thanks a lot!

How do I invoke a button in Unity with everything needed for the "onEndEdit" event of an InputField?

How do I create a method (invoked each time a button is pressed) to invoke everything that is subscribed to the onEndEdit event of an InputField?

I expected the following:

public class DoneButtonInputField : MonoBehaviour
{
    (SerializeField) private InputField inputField;

    public void ClickDoneButton()
    {
        inputField.onEndEdit();
    }
}

But it does not work and I do not know how to look for the answer (probably due to lack of vocabulary).

dynamic – Update of an InputField with {Temporary, Update Function} is triggered

I have a DynamicModule that contains a set of InputFields and a button to recalculate. The calculation takes a while, so I use the dynamic formulation [varname, {Temporary, updatefunction}]. However, if the cursor is in a field I am editing and I then click the recalculate button, the recalculation will be performed without the updated version of varname. What can I add to the button code to trigger the update, regardless of which field the cursor is in? For example, is there a way to simulate the insertion of a tab key stop into the input stream, causing the cursor to leave the current field and move to the next one?

hold – InputField with Boxes-held formatting fails in Dynamic

This is a result of an earlier question.

I have a rich user interface with InputFields whose specific structure I want to retain as the user's input (e.g.(keeping the scientific notation if the numbers are entered in this way). And since the code is pretty much the same for each of these (many) InputFields, I want a function to do it for me. I have a great way to do this:

SetAttributes(HoldInputField, HoldFirst);
HoldInputField(var_, OptionsPattern(FieldSize -> 10)) := 
  DynamicModule({boxes = ToBoxes(var)}, 
    InputField(Dynamic(boxes, 
      Function(result, boxes = result; var = ToExpression(boxes))), 
      Boxes, FieldSize -> OptionValue(FieldSize)))

We can test it like this:

test = 3;
Row({HoldInputField(test), " = ", Dynamic(test)})

Enter image description here

Unfortunately, if the Row statement itself is in a Dynamic Wrapper, the behavior fails:

Enter image description here

Why do I have to do that? Because the number of fields themselves is dynamic. For example:

numFields = 3;
fieldvalue(index_) = 0;
Column({Row({"Number of fields: ",SetterBar(Dynamic(numFields),Range(5))}), 
        Panel(Dynamic(Column(
          Row({"Field ", #, ": ", HoldInputField(fieldvalue(#)), 
              " = ", fieldvalue(#)}) & /@ Range(numFields))))})

Enter image description here

Are there ways to fix this problem? Thanks a lot!

Frontend – Dynamic InputField with syntax highlighting?

I'm trying to create a notebook where a user can type in a Mathematica expression and parse its syntax (number of tokens, compressed size, etc.).

Try this answer

CellPrint @ TextCell[
  Row[{"This is an inline cell with automatic syntax highlighting: ", 
    ExpressionCell[Dynamic@input, "Notebook", "Input", 
     CellFrame -> True]}], "Text"]Dynamic @ input

The Dynamic is not updated entrance, If I do one input box in the expression Cell The syntax highlighting will not be applied, even if I change it Base style, How can I achieve both dynamic behavior and syntax highlighting?

Unit – Remove or change the graphic of the InputField target graphic

I'm working on a game in Unity and need to use an InputField, but I want it to have no edge. Currently it has a black border with an edge radius that needs to be removed.

On my first search I came across this question and thought I had found the answer to my problems.

However, I can not change or remove this TargetGraphic. If I use the button on the right to select a new one and set it to none, the default image will be restored. No pictures are accepted and I even tried to set the target image programmatically, but it did not work.

This is the current appearance of the input, you can see the black border.
entrance

I also tried (without really much hope) to set it like this:

public InputField inputField;

void start ()
{
inputField = GetComponent();
inputField.targetGraphic = null;
}