How can I render placeholders inside text in unity to allow drag n drop on them - unity3d

I want to render placeholder inside text to allow drag and drop behavior on those placeholders like this image
What I want here is how to render this placeholder inside the text object, or even how to place them if the text length is not determined yet

Related

TextMeshPro Input field - can't set placeholders' wrapping to enabled?

I am trying to have a TMP Input Field with multiline (wrapped) placeholder. The input field has its content type set to Integer Number. Placeholder text has some string as text and has wrapping set to "enabled". In prefab editor, it looks ok (text is wrapped). However, when the scene loads, placeholder text immediately has its wrapping reset to "disabled".
The problem: I assume Input field resets the wrapping to disabled on child text, because its content is not multiline, as specified here. I can't set the input field to accept multiline - the option is not in inspector; I can see it if I switch to Debug mode, but as soon as I set it to multiline it switches back to single line. So, how do I set the wrapping on placeholder to enabled without it getting switched back to disabled in runtime? Or, alternatively, how do I set my InputFiled to be multiline (I assume that will fix the wrapping on the placeholder)?
What I have for now:
I have an input field that works like this: when it's not focused, there is a multiline text, for example: "Write your\nnumber here!". When focused, it's replaced by empty line and user can enter an integer number. On finishing input (OnEndEdit) I use the input to spawn some GameObjects and then replace the text again with "Write your\nnumber here!". Editor screenshot:
Right now it works as I expect. However, now I want to dynamically change the placeholder text, so I don't know where the newline will be and I would like for TMP to wrap the text for me, same as it does in Text component with Wrapping enabled.
So: how do I use TMP's wrapping - enabled on InputField without it getting reset to disabled? Either both the user input and placeholder, or just on placeholder itself - doesn't matter.
MultiLine is only available if the Content Type is set to Standard or Auto Corrected.
As soon as you set the input type to Integer Number it basically behaves just like an integer field in the Unity Inspector: No line wrapping but rather overfloating and scrolling to the right.
Alternatively if you need multi lines you could set the Content Type to Custom and then fully flexible adjust it to your needs like e.g.
LineType : Multi Line Newline
Line Limit: 0
Input Type: Standard
Keyboard Type: Default
Character Validation: Integer
And in general: Of course you also can't set a text to an input field that only accepts integer numbers ;) Rather set your placeholder text in the Placeholder object!
Anything that is applied to the Placeholder will be displayed automatically as long as there is no value typed in the input field!

How to have text of 2 different colors with Material-UI text field?

I'm trying to add an autocomplete feature in my project and I'd like the possible autocomplete data to be a greyed out, unselectable and without affecting the user typing.
If I could get the placeholder to be always visible that could work.
I tried setting the value prop of TextField to an JSX.Element but it only accepts primitive types. Fortunately I am using monospace fonts.
What are my options?
A div that is always visible and on-top?
2 text field next to each other with no padding or margin?
Somehow make the placeholder always visible?
Forced example (ignore the cursor)

How to set position label text in TextFormField in outlineborder?

How to set position label in TextFormField in outlineborder?
i want set text position. Because, label prefer to bottom not center in border
According to the documentation for the label
Text that describes the input field.
When the input field is empty and unfocused, the label is displayed on
top of the input field (i.e., at the same location on the screen where
text may be entered in the input field). When the input field receives
focus (or if the field is non-empty), the label moves above (i.e.,
vertically adjacent to) the input field.
So, basically this is the behavior for the label. If you want something else you have to make it on your own ( using a Stack widget with a TextField and a Text ). But with this solution you have to treat the focus properties as well on your own.
You can use this post as a reference
https://stackoverflow.com/a/58039585/10143503

Word 2010: expand a control to fill its table cell

I have a table cell of fixed large size, and in it is nothing but a Plain Text Content Control, whose default placeholder text "Click here to enter text" takes up only a small portion of that table cell.
The problem is that if the user clicks anywhere in the cell but outside of the control's placeholder text, then starts typing, the entered text will not be part of the control and will not be subject to the control's style or any other control properties.
So - other than adding a lot of dummy characters to the placeholder text, which doesn't seem to be predictable in its word-wrap behavior, is there a way to make the control's placeholder text (or, in general, its click-boundary) fill the entire table cell?
UPDATE actually there were some carriage returns after the control that I was not aware of; after deleting those, clicking anywhere in the cell as long as the x coordinate if the click is greater than or equal to the leftmost x coordinate of the control will edit the control text value as desired. If you click leftward of the control, you will end up editing whatever fixed text exists to the left of the control, i.e. a fixed text label. Still strange. The workaround here was to split cells for all multi line text entry areas, such that the label is on its own cell, and the control is now at the leftmost edge of its cell.
Content controls do not support something like expanding to the surrounding container. They will always use only the space that is required to render their content.
If you want to prevent users from clicking and typing text outside of the control, you could use the following approach:
Put a rich text content control around your table/table row/cell
Put the plain text content control as a nested content control in the table cell (the plain text content control must be non-vanishing for this to work)
Make the outer content control read-only
Now the only thing the user is allowed to edit is the inner plain text content control. The downside of this approach is that your document now contains areas that are locked. This has an impact on usability, first, because, it may not be obvious to the user why certain areas cannot be modified, and second, because a lot of standard actions do no longer work if part of the selection is locked (e.g. Select All > Update ToC).

Set text inside UIEdgeInsets?

I want to insert a text inside the area which one surrounded by UIEdgeInsets in UITextView.
Take a look at the following image
Here '1'(surrounded by border for easier understanding) --> The text which one I want to insert inside the UIEdgeInsets.
Here 'one' is the content inside UITextView.
Can I do it? If it is, give me an example.