5
$\begingroup$

I am trying to design a user interface where the specific form that the user enters in InputFields are left unchanged. For example, if the user puts in a number in scientific notation, it would be really nice for that value in the field to stay the same, even though it is modified internally into a different form. None of the Hold-type functions seem to do what I want (and only Hold[Expression] seems to be an option in InputField anyway).

enter image description here

enter image description here

Any ideas?

$\endgroup$
1
  • 1
    $\begingroup$ InputField[Dynamic[var], Boxes]? .. combined with Dynamic[ToExpression@x] to use the evaluated values. $\endgroup$
    – kglr
    Jul 25, 2019 at 20:06

1 Answer 1

8
$\begingroup$
InputField[Dynamic[var], Boxes]

enter image description here

Column[{InputField[Dynamic[var], Boxes], 
  Dynamic[var], 
  Dynamic[RawBoxes @ var], 
  Dynamic[ToExpression @ var] }]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.