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";

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()

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)}, 
      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))}), 
          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.

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

public InputField inputField;

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