Prev: Change position of axes label
Next: Button Problem
From: Dominic on 19 Apr 2010 02:48 Hi, I am writing an application which the user enters an equation and would like to set up an input field for the equation. This is what I currently use: InputField[Dynamic[myFunction], FieldSize -> {20, 4}] However, when I leave the field, the equation is automatically altered by the system. For example, if I enter a polynomial such as z^5+2z^2-2, the system changes it to -2+2z^2+z^5 or if I enter a cube root from the palettes, the system changes it to a 1/3 power. How may I set up the InputField so that it stays in the input the user enters? I cannot seem to get it to "Hold" the format as the user entered it. Thanks guys, Dominic
From: David Park on 20 Apr 2010 05:52 The first problem occurs because Mathematica rewrites the input expression to standard order, which rearranges the terms. One possible solution is to specify TraditionalForm using the second argument of Dynamic. {InputField[Dynamic[func, (func = TraditionalForm[#]) &], FieldSize -> {20, 4}], Dynamic[func]} The second problem occurs because clicking a palette button as an entry method also changes the cursor focus outside of the InputField box and that causes the expression to be entered. There needs to be an option to specify that the field is only entered when the "Enter" key is used and not by changing the focus. I have found InputFields only easy to understand and use with numeric data, and obtain the same kind of problems you bring up with expressions. I hope we may get a useful good answer. David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: Dominic [mailto:miliotodc(a)rtconline.com] Hi, I am writing an application wz5hich the user enters an equation and would like to set up an input field for the equation. This is what I currently use: InputField[Dynamic[myFunction], FieldSize -> {20, 4}] However, when I leave the field, the equation is automatically altered by the system. For example, if I enter a polynomial such as z^5+2z^2-2, the system changes it to -2+2z^2+z^5 or if I enter a cube root from the palettes, the system changes it to a 1/3 power. How may I set up the InputField so that it stays in the input the user enters? I cannot seem to get it to "Hold" the format as the user entered it. Thanks guys, Dominic
|
Pages: 1 Prev: Change position of axes label Next: Button Problem |