1
$\begingroup$

Here is a basic example:

{InputField[Dynamic[x]], Dynamic[x]}

This code generates an input box with and dynamic display. enter image description here

What is disturbing me is that when trying to enter some complex expressions, MMA automatically calculates and updates it in the input box. Is there any way to keep the expression in the input box remains unevaluated?

e.g. If I enter Exp[2.1]:

enter image description here

after I clicked somewhere else, the content of the input box turns into the result immediately, but I want the result to be displayed only beside the input box. enter image description here

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Mar 17 '15 at 16:35
3
$\begingroup$

You are looking for this:

{InputField[Dynamic[x], Hold[Expression]], Dynamic[ReleaseHold[x]]}

example

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Many thanks! This works! $\endgroup$ – Vincent Wang Mar 17 '15 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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